I know this isn’t correct could someone please help me out. I have a MembersListDetails database with 3 fields “Share Email”, “Share Apt No” and “Share Building” fields. These fields either have "YES or “NO” in them.
Then I have a page with a repeater on it that lists each Member’s Name, Email Address, Apt No and Building. Each item’s field in the repeater links to the corresponding “Login Email”, “Apt No” and “Building” field in my MembersListDetails Dataset.
I want my code to read the “Share Email” Field, if it says “YES” I want it to show the “Email Address” content in the repeater. If it says “NO” I want it to hide the content.
Then it should go to the next field the “Share Apt No” Field, if it says “YES” I want it to show the “Apt No” content in the repeater. If it says “NO” I want it to hide the content.
Finally it should go to the last field the “Share Building” Field, if it says “YES” I want it to show the “Building” content in the repeater. If it says “NO” I want it to hide the content.
import wixData from 'wix-data';
$w.onReady(function () {
// $w("#loginEmail").hide();
wixData.query("MembersListDetails")
.eq("Share Email", "YES"), {
$w("#loginEmail").show();
}
.eq("Share Apt No", "YES"), {$w("#aptNo").show();}
.eq("Share Building", "YES"), {$w("#building").show();}
.find()
.then( (results) => {
if(results.items.length > 0) {
let items = results.items;
let firstItem = items[0];
let totalCount = results.totalCount;
let pageSize = results.pageSize;
let currentPage = results.currentPage;
let totalPages = results.totalPages;
let hasNext = results.hasNext();
let hasPrev = results.hasPrev();
let length = results.length;
let query = results.query;
} else {
// handle case where no matching items found
}
} )
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );