Hi guys,
I’m trying to figure out the best way to “iterate” on a collection of Data.
Basically I’m getting parameters from a Webhook, which arrive pretty organized, I’m getting 1-3 sets depending on how many users are being registered, in the below example its 2 users:
As you can see, each group has a set of 5 parameters (+the ItemID which is fixed for all).
My goal is to run and HTTP Post request for each of the groups since I’m not able to put all 1-3 sets on a single JSON for this specific API end point.
I know I need to group them somehow then iterate 1-3 times according to the number of groups I got, but still not sure how…
The final result should be an HTTP Module that would run 1-3 times according to the results arrived in the webhook, with the input being mapped directly from the items in each group.
Here is the Output of the Webhook for whoever wants to play with it:
[
{
"ItemID": "6651478962",
"User1Email": "email1@yahoo.com",
"User1Mobile": "432453235",
"JobFunction1": "Manager",
"JobTitle1": "Boss",
"JobFunctionCode1": "2",
"User2Email": "email@gmail.com",
"User2Mobile": "55566677",
"JobFunction2": "External Consultant",
"JobTitle2": "Big Boss",
"JobFunctionCode2": "3"
}
]
Answered a similar question previously. You need to pass through the JSON so you can easily grab the kvps.
Duplicate of:
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!
1 Like
I like to use repeaters and switch functions for cases like this.
Adding my blueprint below.
blueprint (28).json (6.1 KB)
Set the number of times to run through the data using a repeater and ifs make sure to use required fields.
Set the value of the data based on the number in the loop.
So glad you got the solution
2 Likes
@Mr.Make Thank you for the guidance (a bit similar to what @samliew offered on this this post)
I think I’m on the right track now. Just for some reason the I have issues with the Repeater Module: I have modified yours slightly to take the email address as the refference, so some reason I’m getting only 1 Repeat, even when I’m inputing 2 users’ details. I’m attaching my blue print for refference:
Webhook Repeater Switch.json (13.6 KB)
Here is the data from the Webhook:
I probably messed up the condition of the Repeater module somehow:
If user2email doesn’t exist then 1,then If it does exist then if user3Email doesn’t exist) then 2, else 3
Ok, I found the issue with the Repeater, the Condition syntax was a bit off, it should be like this:
Thank you both @Mr.Make and @samliew For helping me to solve the issue
2 Likes
So glad you got it great work
2 Likes