Count and Display number of imputs from DB

@russian-dima
Thank you for your reply.
Yes my database name is “gckj2gyh”


I want just count the number of rows.
This pattern

I want to display 3

Different from this post.
https://www.wix.com/velo/forum/community-discussion/i-want-to-display-the-total-of-columns

@nanami
Then i think this should do it…

import wixData from'wix-data';

$w.onReady(async function() {  
    let myQuery = await wixData.query("gckj2gyh")
    console.log("Query: ", myQuery)
 
    myQuery.find().then((res) => {
        console.log("Results: ", res)
        $w('#text9').text= String(res.items.length);
    })
    .catch( (error) => {
        let errorMsg = error.message;
        let code = error.code;
    });
});

@russian-dima
Thank you so much!!!
It’s work!!!
I was impressed!!!

@nanami
No problem. :wink:
Good luck & happy coding.

Hello, thanks for your contributions.
I need to complete a filtered dropdown from the database

===============================================


    $w('#dataset3').onReady(() => {

        wixData.query(MiContenedor)
            .eq('idprofesor', xIdDatos)
            .find()
            .then((results) => {
                let food = results.items[0];

                for (let i = 0; i <= food; i++) {
                    console.log(results.items);
                    $w('#dropdown3' + i).value =     results.items;
                }

            })
            .catch((error) => {
                console.log(error)
            });

    });