Hiya all, I'm a total Wix Code newbie and was wondering if I could get some guidance.
As the title states I would like to check if a boolean value is true/false in my collection and if true it shows an image and false it stays hidden; Obviously the below is totally wrong but I've been trying for an hour or so with no further then when I started. Would appreciate any help! Would love to add in this little future in my back-end.
Code below thx!
wixData.query("profile")
.eq("yardPr", "true")
.find()
.then( (results) => {
let isHidden = $w("#10yPrIMG").hidden; // false
if( $w("#10yPrIMG").hidden ) {
$w("#10yPrIMG").show();
}
else {
$w("#10yPrIMG").hide();
}
} )
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );
Hi,
What field in the database saves the boolean value? you should use that in the if statement instead "$w("#10yPrIMG").hidden;". I'd also recommend you to check out this articles about wix code basics.
Try this:
wixData.query("profile") .eq("yardPr", true)