I have a profile database, and want to query that database to make sure that member has compeleted a profile in that database, it then allows them to click button, but the purpose is to allow them to enter another profile (they will have one person/one business. So the button would scan first to see that results are greater than 0 as shown, but then less than 2 (so they are limited to the one personal/one business. Am I on right track with below...something not quite right.
let currentUser = wixUsers.currentUser; { function checkDB() { wixData.query("Profile") .eq("user", currentUser) .find() .then((results) => { if (results.items.length > 0) { $w('#button148').show(); } else { if (results.items.length > 2) { $w('#button148').hide(); } else { $w('#button148').hide(); } } .catch((err) => { let errorMsg = err;
} );
}