I really need help with that matter (2 days trying to solve, without any results…), it is the last difficulty before designing and releasing my app, thanks for you time
I used this formula based on data variable from Airtable REST API:
ORDER(MAP(data[“Food List”], SET_KEY(item, “strength”, LOOKUP(data[“Food Selection”].fields, item.fields.food))), item.strength, “desc”)
And it works perfectly
Here is the schema from Airtable: a list of objects, each object having “createdTime” as an object, “id” as an object and “fields” as an object with 397 properties.
I’m trying to use the same formula based on data variable from Back4App REST API, but it doesn’t work
Here is the formula: ORDER(MAP(data[“Food List”], SET_KEY(item, “strength”, LOOKUP(data[“Food Selection”], item.food))), item.strength, “desc”)
Here is the schema from Back4App: an object with 401 properties
I don’t understand what is the issue here?!?
Does it come from the difference of schemas… Or something else…
Hey @Nicolas_Capuano! Is it on purpose that you have
item.food instead of
item.fields.food as the 3rd to last parameter in the 2nd formula?
Hey @Mari! Yes!
Because in my Airtable schema, each object of my list of data variables contains an object “fields” in which I have my 400 properties, so I need to put a parameter “item.fields.food”.
But in my Back4App schema, each object of my list of data variable is an object with my 400 properties, so I work with the parameter “item.food”.
I’m still wondering if the difference of schemas is the source of my problem…
Ah, got it! Should the schema from Back4App also then be “a list of objects with 401 properties”, instead of “an object with 401 properties”, if you are performing
MAP on it?
I am MAPing my Food List (which is a Collection of data records), so it should be a list of objects with 401 properties. And this MAPing consists in adding a property “strength” to each object (SET_KEY). And I want the values of this property “strength” to be the values of the proerties from an object which is my Food Selection (which is a Single data record).
Hi, the idea sounds right – maybe try building out the formula piece by piece to see if you are getting the wanted result at each step with your data variables?
LOOKUP(data[“Food Selection”], item.food) → does this get you correct the strength value if you put a static value in place of
SET_KEY(item, “strength”, <lookup>) → should work if lookup is correct
MAP(data[“Food List”], <set_key>) → should work
ORDER(<map>, item.strength, “desc”) → ok as you have set “strength”
Something to consider is also that you might have a mixup with nested
item references, you can use aliases for the functions like this:
ORDER<o>(list, o.strength, "desc")
Hope this is of some help
LOOKUP is OK
SET_KEY is OK
MAP is OK with the validation of the formula and the result examples, but I have nothing of the list displayed when trying with the preview portal (it looks that the page keeps on searching without the option of going back to the previous page).
I tried to use an alias with MAP, but if I add , what should be the rest of the formula: MAP(data[“Food List”], SET_KEY(item, “strength”, LOOKUP(data[“Food Selection”], item.food)))