I feel like I’m missing something fundamental here for how to map/lookup an id from one API to a name from another.
Context: I am using two external APIs to pull in 1) a set of teams and 2) games played between the teams and their corresponding points scored.
I’ve figured out how to use one of the APIs (“data.scores1”) to display the list teams and each team’s points scored:
I’m struggling to transform the current.id shown on the left into the team owner’s name using the other API (“data.teams1”). For example, instead of showing “0001”, I want to show “Dustin”.
I think I need to use the FIND_BY_KEY formula to find the “owner_name” from the array of objects in the data.teams1 variable, but not quite sure how to do that.
Can anyone point me in the right direction? Thanks!
Yes in the Primary Label field nstead of displaying current.id you putvcurrent.owner_name
Hmmm thanks for the help but my owner_name is in a different data variable, though both data variables share the same set of ids. From what I can tell, I can only bind and repeat one data variable per list item, is that right? If so, how do I get the list item to replace the id from one data variable with the owner_name corresponding to that id in a different data variable?
I think you might want to use this approach: FIND(pageVars.teams, item.id == current.id).owner_name
By placing this formula in the list items Title Label you should get the results you are looking for. Let me know if this works.
You will want to use the reference to your data variable. I happened to test this solution using page variables.
That worked! Thanks so much @Steve_Stava! To your point, I just needed to substitute my data variable. Final query was:
FIND(data.teams, item.id == current.id).owner_name