Joining linked Fields in a API rows request

Hi

I’ve got three tables in my Soccer App:

Players (individual players)
Teams (teams where I link to the Players table so I can select who is on Team x,y,z)
Events (Tournaments where I link to Teams, so I can see which teams are playing)

Now, ideally I would like to get all information about Events in a single call, but I’m struggling with getting the Players.

I can do this:

/api/database/rows/table/634/?user_field_names=true&Hold__join=Name

But then I only get the Team and if I try to include the Players as well “&Hold_join=Name,Spillere” I will get an ERROR_INCOMPATIBLE_FIELD_TYPE

I suppose this is happening because Players (Spillere) is a linked field.

Any way to solve this without resorting to making two calls and join in code?

Hi @systemaddict,

you are right - it is not possible to join a link to table field in this way. What you can probably do is to add a proper lookup field there and ask for that instead. Would that solve your problem?

I did try that, but I can add more Teams to an Event and ideally the Players should be grouped below each Team.

If I create a lookup field it will fetch all Players I think.

Does this make sense?

It is not possible to do any nesting adhoc lookups via joins. When using join the results are basically nested only 1 level deep. However creating a proper lookup field in Teams into the Players table and then requesting that field via join from Events could make the result you are after perhaps?

1 Like

That actually worked. Thanks :slight_smile: