Hi,
I need help with a simple database query. I use dynamic pages for news. Within the database structure, I have created a field with uploading a document (attachment) and I would like to display a vector element on the site only if a file will be stored (uploaded) in the database. I try this function, but it doesn’t work. Anyone can help ?
Thank you in advance,
Jan
import wixData from ‘wix-data’ ;
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
$w.onReady( function () {
$w( “#dynamicDataset” ).setFilter(wixData.filter()
.eq( “attachment” ).value)
.then(() => {
console.log( “Dataset is now filtered” );
let count = $w( “#dynamicDataset” ).getTotalCount();
if (count > 0 ) {
$w( “#attachment” ).show();
}
else {
// tell that there are no results
}
})
. catch ((err) => {
console.log(err);
});
});