Results on table

Hi how can i show a message when the result query is ‘0’ empty

my code

export function shape10_click() {
wixData.query(‘database_trade’)
.contains(‘Segmetos’,$w(“#country”).value)
.eq(‘Tipo’, $w(‘#state’).value)
.eq(‘uf’, $w(‘#selection1’).value)
.contains(‘cidade’, $w(‘#selection3’).value)

.limit(1000) 
.descending('Logo','uf') 
.find() 
.then(res => { 
  $w('#tabela').rows = res.items; 
   console.log(res.totalCount); 
  $w("#shape9").collapse(); 
  $w("#text29").collapse(); 
  $w("#shape10").collapse(); 
  $w("#shape11").collapse(); 

 }); 

}

i´ve tryed to use de if statement but it doesn´t work

how can i do it

i want when the totalcount === ‘0’
then show a message for the user

thanks

if (res.totalCount === 0) {
do stuff
}

the res appear undefined ?

in don´t know how defined the res

Hey Duda,

Does IDE show you any errors with your code? Have you also tried console.log(res);? Could you maybe send us a screenshot of your whole code?

IT WORKS

TKS a LOT

What code do I need to add, and where do I add it, to show a site visitor the number of repeater results? And also if there are zero results…Thanks.

import wixData from ‘wix-data’;
export function button1_click(event, $w) {
wixData.query(‘Shopper’)
.contains(‘shopperZipcodes’,$w(‘#input1’).value)
.contains(‘shopperStores’, $w(‘#input2’).value)
.find()
.then(results => {
$w(‘#repeater1’).data = results.items;
$w(‘#repeater1’).show();
});
}

SEnd me via e-mail please I’ll try to help you duda.aleo12@gmail.com