Hello! i am using a repeater and i want to collect a data from my database without using datasets to be displayed in the repeater

i am assuming that the repeater would do the job for filling up the rest of my page with the contents that i have in my database? or am i wrong? this is one of the code i have tested that didnt work that i think is closest to what i am trying to achieve.

import wixData from ‘wix-data’ ;
$w.onReady( function () {
wixData.get(’ animals’ , ‘animalAge’ ) //collection, field name
.then((result) => {
$w( ‘#datePicker1’ ).value = result; //yes, a datepicker and not a text element. i got it disabled so it cannot be modified.
} ); } );

can anyone give me some tips or examples??


If you would like to display the data from your data collection to a repeater on your site, you must set the repeaters data from a database query.
You can find an example of how to set up the query within the Corvid API reference by clicking here .

From the code you provided, it looks like you will need the onItemReady() function to set a callback that populates the repeater’s
elements with the item data from the data array. Then you will need to query your data collection to populate the data into your repeater. To find an example of how to do this from the Corvid API Reference, click here .

I hope this information was helpful!
Best Regards,

hello, thank you for your reply! i tried query reference but still no luck.

import wixData from ‘wix-data’;

$w.onReady( function () {
wixData.query( “animals” )
.then( (results) => {
let animalAge = results.items; //tried results.item; and results;
$w(" #datePicker1" ).value = animalAge;
} )
. catch ( (err) => {
let errorMsg = err
} );

this is the error
Wix code SDK error: The text parameter that is passed to the text method cannot be set to the value [object Object]. It must be of type string.

Hi :raised_hand_with_fingers_splayed:

When querying, set the query result to be the repeater’s data, then use the repeater’s onItemReady() function to populate the data.

wixData.query("animals").find().then( (result) => {
    $w('#repeater1').data = result.items;
}).catch( (err) => {

$w('#repeater1').onItemReady( ($item, data) => {
    $item('datePicker1').value = data.animalAge;

This will populate each and every animal’s age on the date-picker, just make sure you’re placing this code inside the page’s onReady() function.

Hope that helped~!

it worked like charm with sweet sprinkled toppings on top! i cant THANK YOU enough!

You don’t need to, I’m glad that my answer helped you :wink:
You’re welcome anytime.