cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
nohus
Level: Powered On

A flow which counts list elements on Sharepoint

Hi

 

I have been asked to create a Flow which can do more or less this:

 

I have two lists; "Total" and "In use".. The first list has two elements titled "squares" and "circles", and it has a column called "quantity". 

 

The second list tells us who has the squares and circles. So, a list element there may be; "Title: Square; User: John; Quantity: 3; Status: In use". The second list also lists the number of circles we have purchased ("Title; Square; User; 'empty'; Quantity: 40; Status: Purchased"). 

 

I want to create a flow which once per day counts how many squares and circles we have in stock and edits the quantity column on the first list accordingly. So, it adds all the purchased items and subtracts all the ones in use. 

 

There are, of course, alternative approaches to managing items. However, I cannot see how to create a flow which runs through an entire list neither do I see a way to do something akin to "circles = circles + total" for other approaches to the problem (like having a Flow edit the first list whenever the second list gets a new element). 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: A flow which counts list elements on Sharepoint

Hi @nohus,

 

I have made a test on my side and have created a Total list as below:

Capture.PNG

And i have created a In use list as below:

 

Capture.PNG

 

You could refer to screenshot below to create the flow to achieve your needs:

Capture.PNG

Capture.PNG

Capture.PNG

 

The expression in the Update item action as below:

sub(body('Get_item')?['quantity'],items('Apply_to_each_2')?['Quantity'])

The expression in the Update item 2 action as below:

add(body('Get_item_2')?['quantity'],items('Apply_to_each_2')?['Quantity'])

 

The flow would run successfully as below:

Capture.PNG

 

The Total list would be updated as below:

Capture.PNG

 

Best regards,

Alice

 

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: A flow which counts list elements on Sharepoint

Hi @nohus,

 

I have made a test on my side and have created a Total list as below:

Capture.PNG

And i have created a In use list as below:

 

Capture.PNG

 

You could refer to screenshot below to create the flow to achieve your needs:

Capture.PNG

Capture.PNG

Capture.PNG

 

The expression in the Update item action as below:

sub(body('Get_item')?['quantity'],items('Apply_to_each_2')?['Quantity'])

The expression in the Update item 2 action as below:

add(body('Get_item_2')?['quantity'],items('Apply_to_each_2')?['Quantity'])

 

The flow would run successfully as below:

Capture.PNG

 

The Total list would be updated as below:

Capture.PNG

 

Best regards,

Alice

 

View solution in original post

Administrator
Administrator

Re: A flow which counts list elements on Sharepoint

Hello, @nohus!

Have you had an opportunity to apply @v-yuazh-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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
Top Kudoed Authors
Users online (9,407)