I’m trying to check a null value of the file filed where I have stored PDF files.
I want to check if the file is null or not, if null then it will show a div else it willn’t.
import wixData from 'wix-data';
$w.onReady(function () {
const customDiv1 = $w('#columnStrip16');
customDiv1.hide();
$w('#button3').onClick(async function () {
const query = wixData.query('JCMathsWorkedSolutions');
query.find().
then((results) => {
if (results.items.length > 0 && results.items[0].File) {
console.log(results.items[0].File);
console.log('File is not empty');
} else {
console.log('File is empty');
customDiv1.show();
setTimeout(() => {
customDiv1.hide();
}, 1000);
}
});
});
});
How can I fix it?