How do I work with an array.object in Flow Designer?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 04:20 AM
Hi everyone!
I have this multi row variable set I use on a form. It consists of two variables:
- IP address (type string, but I chose it as an IP address type string)
- Servername (type string)
So, I read that variable set in my flow. The runtime value looks like this:
[ {
"ip_adresse" : "1.2.3.4",
"servernavn" : "test01"
}, {
"ip_adresse" : "5.6.7.8",
"servernavn" : "test02"
}, {
"ip_adresse" : "10.0.0.1",
"servernavn" : "hjem"
} ]
When I use a for each on that variable, I can choose the object.array in my for each.
When I want to do anything with the specific values, the object and the two string datapills are greyed out. Can't use them.
I can add a transform function (get nth object) to the array.object and get a single object, that then looks like this:
{
"ip_adresse" : "1.2.3.4",
"servernavn" : "test01"
}
But - how do I iterate through all variables in the multirow variable set, and use the actual values?
- Is there a way to do it in pure flow designer?
- If so, can you please enlighten me?
- Do I create a custom action/subflow?
- If yes, what do I put in there to be able to get to and use the values?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 04:43 AM
Hello @Jacob Saaby Nie ,
Can you parse the values and fetch it.
var mrvsParsed = JSON.parse(current.variables.internal_name_of_mrvs.toString());
for(var x in mrvsParsed){
var IP_Address= mrvsParsed[x].ip_adresse;
var server_name= mrvsParsed[x].servernavn;
gs.info("IP Address= " + IP_Address+ " " + "Server = " + server_name);
}
Thank you,
Omkar