How to obtain related table data in an Object data type
![Mr_English](https://us.v-cdn.net/6037124/user_avatars/1271230.jpg)
I have a table 'profiles' which contains a column of object type. This holds 1 or more references to a table called 'clubs'. I want to pull the value of 'ClubName' from table 'clubs' when I fetch the profile records.
I watched the video 'Addons: Single vs List Return Types' provided by @Michael Udinski but my case is slightly different, in that Michael's has just ids, whereas mine has keys also, i.e.
clubs: [
{
clubs_id: 59,
clubs2_id: 28,
}
What I am looking for is something like this:
clubs: [
{
clubs_id: { id: 59, ClubName: 'Bristol City' }
clubs2_id: {id: 28, ClubName: 'Liverpool' }
}
Currently the returned data looks like this:
I tried a couple of ways to do this but could only get data for one of the clubs in the list
That appears to be so because it's only possible to select a single column, e.g.
I created an addon, to return a list (as from Michael's video) but that only attaches itself to one of the clubs not both.
Any suggestions anyone?
Thanks.
Best Answer
-
@Michael Udinski I've solved it.
To add the extra club, I mistakenly clicked the + button at the top. Instead, I should have added the additional clubs in the clubs_id column.🤦♂️
Having done that, I was able to pull back related data using an add on, as per your video:
Answers
-
Hi, does the object with club id's always have two club_ids in it?
If yes then I think that addons are the way to go, but you need to apply them twice for both clubs_id and clubss_id, inside the array
-
@Mr_English - can you tell me more about your schema structure? What is the difference between clubs_id and clubs2_id? What does your clubs array set out to accomplish? I'm wondering if there's another structure that makes more sense here
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback