working on a shoping list app.
in a page where the user save’s his list to a name,I am looking for a value (list name) in one of my tables “shoppinlist” using corvid:
row = await wixData.query(“shoppinlist”).eq(“listName”, $w(‘#txtListName’).value).find().then((results) => {
console.log(“Search term:” + $w(‘#txtListName’).value);
length =results.items.length;
return results.items;
});
The next bit of code works fine when i get results:
console.log(“results:” + row[0].listName.toLocaleString());
console.log(“result length:” +length);
if (row[0].listName.length > 0) {
console.log("List found " + row[0].listName);
$w(‘#txtListName’).value = “please choose new name”;
return ;
}
But when the query gets no result the code seems to stop running, and this is a problem !
i need to know when the list exist’s or not and this is not working for me.
can you please advice what am i doing wrong ?
thanks !