cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft Employee

SharePoint list Items

 

Im trying to iterate through a SharePoint list and adding one field of each item, getting the total value of the field in all items.

Example:

Get SharePoint List Items
• Item 1: Name: Markus , Age: 20
• Item 2: Name: Ana, Age: 30

ForEach Item:
• Compose Age Item 1 + Age Item 2

Total Age of all items = 50
….
How can we achieve this with flow ?
Markus

1 REPLY 1
Community Support Team
Community Support Team

Re: SharePoint list Items

Hi @mrkschrstn,

 

If item1 and item2 are two items from the same SharePoint list, then I am afraid add the corresonding age together is not an easy task.

The thoughts here is first find the age of Markus (One Apply to Each), then iterate through the SharePoint lists(another apply to each) again to get Age of Ana, and add them together.

The limitaion here is nested Apply to each is not supported, at least currently.

Workarounds here is to use formula to find the proper item. 

"@body('Get_items')?['Value']?[0]?['Age']"

Writing in this way would be able to find the other array item, in Microsoft Flow,  WDL language uses number to query the array item, start from 0.

This would require the item sequence being noticed when configuring Flow.

Assuming the corresponding item from SharePoint List->Get items Action is 3, and 5, then the formula which would add them together should be:

"@Add(
         body('Get_items')?['Value']?[3]?['Age'],
         body('Get_items')?['Value']?[5]?['Age']
     )"

Formula reference

 

 

For two fields defined in the same SharePoint list, we could add a calculated column directly in SharePoint list, or using one Apply to each to make it work.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 122 members 4,582 guests
Please welcome our newest community members: