Manipulate API data

I want to retrieve data from the API and then send it to the database.

However, I do not want to send it in the raw form, but rather in a manipulated form. E.g. in the picture below, we have the following pairs database = API (e.g. fixtureID = fixtureID):

However, I don’t want the raw relationship above, but e.g. the following:
goals_conceded = 0 (if goals_conceded <= 1) or 1 (if goals_conceded > 1)

How can I do so?

You can duplicate the Create a new player... action and apply conditions to both:

  1. The first one will execute Only if goals_conceded <= 1, and it will create the player with goals_conceded = 0.
  2. The second one will execute Only if goals_conceded > 1, and it will create the player with goals_conceded = 1.
1 Like

@jmalmeida

thanks for the reply.

yeah, makes sense. but what if I have several such conditions? e.g. beside the one I mentioned we also have:
goals_scored = 0 (if goals_scored <= 1) or 1 (if goals_scored > 1)
own_goals = 0 (if own_goals <= 1) or 1 (if own_goals > 1)

do I have to create a separate action for each combination of these events (in this case 2x2x2 = 8)?

thanks again

0 or 1 is a boolean, is like false/true, no/yes.

So you could define goals_conceded, goals_scored and own_goals as type yes/no and then in the Create a new player... action set:

  1. goals_conceded = goals_conceded > 1
  2. goals_scored = goals_scored > 1
  3. own_goals = own_goals > 1

Instead of 0 you’ll have no, and instead of 1 you’ll have yes.

No conditions.

I am still unsure whether I understand this part. if “goals_conceded = goals_conceded”, does it evaluate to yes thus 1? why do we then have the condition “>” if it will never evaluate to sth higher than 1?

I hope what I wrote makes sense

In the expression: 1. goals_conceded = goals_conceded > 1

The first goals_conceded is the field in the New player data type, the second goals_conceded is the data from the API.

So:

  • if the data from the API > 1, then goals_conceded > 1 = yes, then goals_conceded = yes
  • if the data from the API <= 1, then goals_conceded > 1 = no, then goals_conceded = no