cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JoeO Helper II
Helper II

Return value from multiple array entries

Hi,

 

I have an array called "in_groups". The "in_group" array has a value called "group_label". I would like to create an expression that would return just the value of both group lables. Normally, this would be a for-each operation, but i would like to combine the results so that my output looks like this:

 

All users

Global Users 

 

{
"in_groups": [
{
"group_id": 2,
"group_label": "All users",
"_is_system": true
},
{
"group_id": 4,
"group_label": "Global Users",
"_is_system": false
}
]
}

4 REPLIES 4
Community Support
Community Support

Re: Return value from multiple array entries

Hi @JoeO,

 

Could you please share a screenshot of your flow's configuration?

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Compose action, Inputs field set to following json data that you provided:
{
"in_groups": [
{
"group_id": 2,
"group_label": "All users",
"_is_system": true
},
{
"group_id": 4,
"group_label": "Global Users",
"_is_system": false
}
]
}
  • Add a Variables-> "Initialize variable" action, Name set to FinalValue, Type set to String and Value set to empty.
  • Add a "Apply to each" action, input parameter set to following formula:
outputs('Compose')?['in_groups']
  • Within "Apply to each" action, add a "Compose 2" action, Inputs set to FinalValue variable. Add a "Compose 3" action, Inputs set to following formula:
item()?['group_label']

Add a "Set variable" action, Name set to FinalValue variable, Value set to following formula:1.JPG

In first line, type the output of the "Compose 3" action. In second line, type the output of the "Compose 2" action.

 

  • Under "Apply to each" action, add a "Compose 4" action, Inputs field set to FinalValue variable.

Image reference:2.JPG

 

3.JPG

 

 

The flow works successfully as below:4.JPG

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
JoeO Helper II
Helper II

Re: Return value from multiple array entries

Hi Kris,

Thanks so mcuh for the detailed response. Really appreciate your insight. I've tested it, and get the desired results in the second “Apply to each” step. The question is, i've been trying to understand what it is that you're doing, but im not fully understanding it. If you dont mind, can you give me a brief explanation on what we’re doing here, especially the initialize variable step and the 2 outputs?

 

JoeO Helper II
Helper II

Re: Return value from multiple array entries

I actually tried the "Select" operation as a more simple approach, and it seems to work, but im trying to figure out (if possible) how to just retrieve the values w/o the rest. Currently im getting this (with the select operation):

[
"All users",
"Global User"
]

 

In_Group.png

 

JoeO Helper II
Helper II

Re: Return value from multiple array entries

Reviewed this again real quick, i do understand the solution and its working well. Just wondering whether its possible to simplify, esle i'll stick with this.

 

Thanks!!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,254)