databaset counter help

I need help to count how many images I have in the media gallery field.

I tried

$w ("# text789").text = $w ("#gallery1"). items.length.toString ();

and it worked but it counted zero, since the images are on the date and not in the gallery itself

I know I need a query but I’m a beginner in the codes and I don’t know how to do it

Hey,

You can do this using the query() function from the wix-data API.

Hope this helps!

Dara | Corvid Team

he succeeded, what was happening was that he was counting arts from the database to load the images, so he counted zero.

I added a timer to count after a few seconds

setTimeout(function () {
$w ("#counter_text").text = $w ("#gallery_Id"). items.length.toString ();
}, 1000);