Let’s say I field fieldOne and fieldTwo in my database (#dataset1), and items #box1 and #box2. How do I code:
If fieldOne isEmpty then collapse #box1
Here’s the isEmpty API documentation
Let’s say I field fieldOne and fieldTwo in my database (#dataset1), and items #box1 and #box2. How do I code:
If fieldOne isEmpty then collapse #box1
Here’s the isEmpty API documentation
wixData.query(“myCollection”) .isEmpty(“bio”) .find() .then( (results) => { let items = results.items; let firstItem = items[0]; let totalCount = results.totalCount;
if (totalCount === 0) { $w(”#box1”).collapse(); }
} ) .catch( (error) => { let errorMsg = error.message; let code = error.code; } );
UPDATE
This code is working
$w.onReady(function () {
$w("#dynamicDataset").onReady(()=>{
let itemObj = $w("#dynamicDataset").getCurrentItem();
if(!itemObj.retail){
$w("#box1").collapse();
}
});
});
itemObj.retail ??? what is .retail? please assist
i’d like to know too please