Return something if no search results

Hi. I have this little problem (I think) I want to return something to the repeater I use if the query returns nothing. Here’s my code:

wixData.query(“rentals”)
.contains(“location”, locale)
.not(wixData.query(“rentals”).contains(“propertyType”, “House and Lot”))
.limit(20)
.ascending(“Title”)
.find()
.then(res => {
$w(“#repeater1”).data = res.items;
});

What I want is check if the res.items returns empty and if true, put something on the repeater saying “No properties found for your search”.

Is this even possible?

Thank you.

if (!res.items) { $w(‘#noItemsText’).show();} else {$w(‘#noItemsText’).hide();}

where #noItemsText is a text element hidden on load.

so I just have to hide the repeater then show the text element? thank you for the answer David.

@rosalinejayb Sure thing. I think if there are no results the repeater won’t show anyway, so you shouldn’t have to worry about that.

Hi David, i used your code ///i f (!res.items) { $w(’ #noItemsText ‘).show();} else {$w(’ #noItemsText ').hide();}/// to a repeater. It works and shows the text element. How do I hide a text element if the items in the repeater is >0