Multiple Reference to repeater

Hey guys,
I query a database with a multiple reference field and include the database from the reference field. I pass it successfully to a repeater:

$w(“#repeater6”).onItemReady(($item, itemData, index) => {

    console.log( itemData ) 
    $item("#text43").text = itemData.title + " von:" + itemData.anfang + " bis:" + itemData.ende +" EUR" + itemData.bruttoPreis.toString() + " " + ???  

The console.log(itemData) show the following structure:


Question: How can I get the gerate: Array into the repeater?
The first Repeater Item should look like: Mittwoch von12:30 bis 13:30 EUR 200 Geräte: Diego, Tymo

Thanks a lot for your help guys!

You are using onItemReady, have a read of the ‘Note’ section from the Wix API reference for it.
https://www.wix.com/corvid/reference/$w.Repeater.html#onItemReady

Try using forEachItem and you can view the code from the same Wix API reference too.
https://www.wix.com/corvid/reference/$w.Repeater.html#forEachItem

thanks @givemeawhisky for your quick answer which brought me in the right direction!!! There is just a small peace missing still :confused:
My code update:
$w(“#repeater6”).forEachItem(($item, itemData, index) => {
console.log (itemData.gerate)
$item(“#text43”).text = itemData.title + " von:" + itemData.anfang + " bis:" + itemData.ende +" EUR" + itemData.bruttoPreis.toString() + " " + itemData.gerate.title

}) 

Question: why having undefined in the text below?

Because gerate give you back an ARRAY. Look closer :wink:
Your last value you past to you Text:
itemData.gerate.title
should be
itemData.gerate[index].title
Now it should work :wink:

Viel Erfolg.
PS: Was ist eigentlich “gerate”? :smiley:

@benibrodi thanks for your support and your quick answer. I was hoping to achive that I can show all rows of the Array. Something like itemData.gerate[ ].title or itemData.gerate[1,2,n].title but since the number of arrays are not always the same, I guess I need a loop or something more complex, right?

PS: Esd sind so art Fitnessgeräte zum mieten :slight_smile: Danke für die schnelle Antwort!

That’s right, you need to give an Index to the Array, which Item you wanna get.
An the forEachItem gives you the “Index”-Value directly to use.

So if you would use

console.log(index);  // 0, 1, 2, 3, ...

So that’s why

itemData.gerate[index].title 

would do your job :wink:

PS: Achso, das heisst “Geräte”. Habe irgendwas mit “geraden” in Richtung Trigonometrie gedacht. :smiley: