I’m consuming an API endpoint which returns data in this format:
// other attributes
I’m saving the above response in a data variable named “timeline_data”.
I’m now trying to show a list of type “photos” based on the array of objects “timeline_data.included”.
When I try to fetch the “username” using the following formula for each repeated photos, it does not work.
PICK_ITEM(SELECT(data.timeline_data.included, (item.type == "users") && (STRING(current.attributes.owner_id) == item.id)), 0).attributes.email
You’re right that it’s a bit illogical that that doesn’t work. However, you can use the LOOKUP formula to access properties of objects returned as the result of another formula, so this works:
LOOKUP(LOOKUP(PICK_ITEM(SELECT(data.timeline_data.included, (item.type == "photos") && (STRING(current.attributes.owner_id) == item.id)), 0), "attributes"), "email")
(We’ve got plans on how to make long formulas more understandable too – that’s starting to be a bit painful.)
In my case
timeline_data.included contains objects of both
I think I have only one option to filter
SELECT method in formula editor.
When I write
SELECT(data.timeline_data.included, item.type == "users"), example results do not show correct data. And when I hit the “OK” button to preview my results, it also does not work as expected.
How can I filter an array of objects correctly ?
The examples shown in the editor need a bit more love – the results of complex formulas are not evaluated correctly into the example data; here it’s just showing that the result is “an array of objects with this schema/example data”.
The formula looks correct though – does it fail in the app itself too?
Do you need consultant for assistance of “make long formulas more understandable too”?
@s_p, I think we’ve got Composer Pro product design covered without external consultants, but if you’re interested in joining AppGyver as an employee, you can always send an open application to email@example.com.
What kind type of people you are recruiting?
Lastly working with developing / defining of business / product concepts, and not doing any kind of programming work. Is concept developer someting what appgyver is recruiting?
- kesäkuuta 2020, klo 13.50, “Harri Sarsa via AppGyver” <firstname.lastname@example.org> kirjoitti:
At the moment the open positions do benefit hugely from programming expertise, but drop a line and we’ll at least keep you in mind!
Hope to get the job descriptions up somewhere soon, currently they’re available on MeetFrank.
The actual formula gets little bit more complicated as I have to use this formula within a
repeated component. It was not working last Friday but I’m able to get it working now.
I think may be
LOOKUP did the trick.