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

Jacob Saaby Nie
Tera Contributor

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?

  1. Is there a way to do it in pure flow designer? 
    1. If so, can you please enlighten me?
  2. Do I create a custom action/subflow?
    1. If yes, what do I put in there to be able to get to and use the values?
1 REPLY 1

Omkar Kumbhar
Mega Sage
Mega Sage

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

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.