Get value of Related->Related entity record

So I have three entities: Cities, Countries and Continents. All of them have two extra fields: Name, and then also a relation to a “parent” entity.

A City is related to a Country. A Country is related to a Continent.

I want a Custom List with three labels in each item in the template: One for City.Name, one for Country.Name, and one for Continent.Name

I use the Cities entity as my data datasource and then bind the three labels like this:
Label 1: ThisRow.Name (works!) :+1:
Label 2: ThisRow.Country.Name (works!) :+1:
Label 3: ThisRow.Coyntry.Continent.Name (does not work - blank!) :sob:

Any ideas?

-Jeppe

Im looking for a similar solution, my use case is sales lines for each of the sales orders linked to a salesperson.

So I hope you find a good solution.

1 Like

@jjes @Michaeljep

You can set the relationship depth to 3 and it would get the third level as well in get records

image

Alternately Second level of relation is getting the id…so we can use get record by id and get the values as needed

The image shows a configuration screen for the "Get Entity Record By Id" action, where the entity is set to "RelCountry" and the Record Id is dynamically set to "currentRelCity.StateField.CountryField.Id." (Captioned by AI)

Both of the above would work

cheers

But I’m not even getting the 2nd level ID :person_shrugging:

1 Like

@jjes

did you change the relation depth? in properties?

cheers

@Anil_G This is in Apps, getting the records through direct data binding. Not in an automation.

1 Like

Hi @jjes,

This is a limitation of the Apps and Data Service. complex relationships aren’t supported. You can only establish relationships one level deep, meaning you can’t create parent-to-parent relationships.

To work around this, you should create a text field for the continent within the Country entity. This way, you can achieve the desired structure.

I’ve reported this issue to the product team, and they are aware of this limitation.

Thanks,
Arvind

1 Like

Hmmm… that would be a mess, data-wise and from a maintenance perspective.

It just seems insane to me that there is not a way to traverse data through more than one level?!

Otherwise I might have to do a merge in a server-side process, but from my experience, latency is just crazy so I want to avoid server-side processing at almost all costs. Agree?

Cheers,
Jeppe

I agree, I know that but this is what it is. I have faced this challenge before and i had to manage a flat entity to save and get records.

1 Like

You could put an additional relationship to continent into city. It’s a hassle if you have to update the middle level because it also requires updating the lowest level, but in your case your hierarchy should be pretty stable.

Maybe you can jury-rig something with custom fetches and list sources if you really want to, idk Apps - Custom HTML

1 Like

@Arvind_Kumar1 @Stefan_Reutter
My real hierarchy is not City->Country->Continent, it is much more dynamic unfortunately, so a flatter structure would bite me in the as* very quickly. So I think I might just go with a server-side function that can fetch and model a datatable to my liking. Not what I want to do, but that’s life. :slight_smile:

Thank you both for your always qualified input :+1: :+1:

1 Like

If matching keys are present in related entities, then assign the selected city to a variable and use the Query Builder to get the related entity name. A rough example: