cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IT_Matt
Helper I
Helper I

How to get just the "Value" of the "Current Item" in an "Apply to each" Condition

Hi All,

I'm trying to get just the "Value" property of the "Current Item" within my "Apply to Each" condition. The Current Item actually contains several properties including "@odata.type", ID and Value. I'm looking for the code to just get the value of the string because dynamic content doesn't provide it. items('Apply_to_each') is the present code and need to drill down and get just the "Value" property. image.png

1 ACCEPTED SOLUTION

Accepted Solutions
RezaDorrani
Dual Super User II
Dual Super User II

Hi @IT_Matt 

 

within apply to each

use expression item() - this will give you context to currently running item in the loop

 

so if Value is available withoin location loop

 

use item()?['Value'] - this should be used as an expression

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

View solution in original post

4 REPLIES 4
RobElliott
Super User
Super User

Hi @IT_Matt I'm not quite sure why you would have an apply to each on this as you have just created a single file and got the details of that file, so I don't know what the apply to each is doing there. Am I missing something here (probably!) ?

Rob

Los Gallardos


copy_file.png

 

 

RezaDorrani
Dual Super User II
Dual Super User II

Hi @IT_Matt 

 

within apply to each

use expression item() - this will give you context to currently running item in the loop

 

so if Value is available withoin location loop

 

use item()?['Value'] - this should be used as an expression

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

View solution in original post

Hi Rob,

 

The reason for the "Apply to Each" is because the "Location" is a SPO column that has multi-selections. I need to use each selection as the destination folder name (library name). 

So to start at the beginning I have a user uploading a file to a library and they add metadata under the location column by selecting the locations the file needs to go to. I have Flow looking at the selections in that location column to see which libraries the file will need to be copied to.  

Hope this helps. 

Borup
New Member

If using Power Automate Desktop this is an other syntax.

 

If using af SQL-execution step like this:

SELECT COUNT(*) Cutomers FROM CUSTTABLE

 

The you can set a variable step like this:

Set (Customers) To: %QueryResult[0]['Customers']%

 

You can also use a loop for this:

For Each (CurrentItem) in (QueryResult)

... Set variable (Customers) to: %CurrentItem['Customers']%

... Break Loop

End

 

Happy coding with Power Automate Desktop https://aka.ms/GetStarted-PAD

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,447)