Populate Page Variable list of objects from Data Variable

We have a data variable connected to a RestAPI. From the large input of JSON, we would like to populate a page variable with just a few basic fields from the data variable.

Here is the page variable we would like to populate:

Here is a part of the data variable we are populating from:

Hey,

This can be done with the formula function MAP()! After you have retrieved the data from the REST API using Get Records, you can add the logic node Set Page Variable after it. Then, using a formula for the assigned value of the page variable, you can use MAP() to modify the original data to the same schema as the page variable, it would looks something like this:

MAP(data.SoccerDataAppVar, {awayScore: data.SoccerDataAppVar.awayScore, awayTeam: data.SoccerDataAppVar.awayScore, game_id: data.SoccerDataAppVar.id, homeScore: data.SoccerDataAppVar.homeScore, homeTeam: data.SoccerDataAppVar.homeTeam } )

So here you take the original data list, and for each item in the list you transform it to the same schema and property names as the page variable and assign the correct data from the original list to each property. The data.SoccerDataAppVar.___ depends totally on how these different properties are named in the original data list, the examples I used in my formula are just guesses from my part.

Note that the property names have to match exactly in your MAP() formula and in the page variable, and the data types need to match too.

Hope this helps!

2 Likes

<your idea was good, but you have to use the Item>

tried this but
does not work