Accessing a field in a referenced collection by code using itemData.

Hi, i’m struggling to get this work. If my main collection is “Songs collection” how I populate my repeater with the field “Bio” from the “Artist collection” by code using itemData?

$item(‘#text1’).text = itemData.artist.bio; //doesn’t work

The tutorial where you got that pic from doesn’t need the use of code as it uses reference fields which is sorted and populated through the settings of the table that you connect the dataset too, as shown in the tutorial example itself.
https://support.wix.com/en/article/about-reference-fields-in-database-collections

Also, have a look at this page too.
https://support.wix.com/en/article/displaying-content-from-multiple-database-collections-using-reference-fields-4034931

As for code, then have a look at the API reference link below.
https://www.wix.com/corvid/reference/$w.Repeater.html

hey thanks for reply. I actually looked at the API reference but still without luck finding a solution. I know how to connect the dataset to repeater through the UI but this is not practical to what I using since I populate my repeater based on certain conditions and buttons. For context I will add a partial code of what I got right now on page:

import wixWindow from 'wix-window';
import wixData from 'wix-data';
$w.onReady(() => {
   $w("#button2").onClick(() => {
     wixData.query("songs")
    .eq("Artist","Eric Clapton")
    .limit(1)
    .find()
    .then( (results) => {
   $w("#repeater1").data = results.items;
    } );
    } );


 $w("#repeater1").onItemReady( ($w, itemData, index) => { 
    $w('#text1').text = itemData.artist.bio; // my problem :(
 
    $w("#button1").onClick(() => {
 const repeaterItem = itemData;
      wixWindow.openLightbox("details", repeaterItem);
    });
  });
 
});

So what I want is to show the field “Bio” on $w(‘#text1’).text, the: ''Eric Patrick Clapton is an…"

thanks in advance!.

$w("#repeater1").onItemReady(async ($w, itemData, index) => {
    let artist = itemData.artist;
    const res = await find_artist_info(artist);
    $w("text1").text = res;
})

function find_artist_info(artist) {
    return wixData.query("artist")
    .eq("name", artist)
    .find()
    .then((res) => {
        return (res.items[0].bio)
    })
}

i will do this instaed, the referenced group is too confusing to me

thanks chade, I would test your workaround later at home :slight_smile: . Very hard to find a methodological answer or even any at all from a mod/admin on this forum. Regular users helps A LOT!

Hi, i have the same problem and no matter what i do i cant access the reference data.
I have a repeater that shows items from the collection ‘components’, each component have a ‘component type’ which is a reference field that contains one type item from a collection of ‘component types’. in the types collection i have field named ‘Hex Colors’ and for each type i specify a hex code that i want to show as background color of the container box in the repeater.
tried everything and starting to get frustrated… please help!