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

Help to get number of items in a list!

Hi,

 

I am working in a Flow that should counts the number of items in a list that has repeated value on other words I have a list that contains a calculated column to get the number of the week. In this list should not accept more than 5 items with the same week number so I am trying to create a Flow to avoid create new items if the number of the same week is larger than 5.
Right now I have a Flow that counts all the items and I don't know how to check how many items exists with the same week number. 

Flow.PNG

Here the "indata" is giving me the total of items in the list without checking the week number. How add the logic to check if the number of the same week is larger than 5?

 

Best regards

Americo

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Help to get number of items in a list!

Hi @SpDev,

 

I did a test on my side, it seems that it can't use Calculate column in Filter Query.

Maybe you could consider using variables to implement the requirements, initialize a variable of type Integer

Use the value of the week number in the trigger to compare with the week number of all items in the list. If they are equal, the variable is incremented by one.

Finally, compare the value of the variable to greater than 5. If it is greater than 5, delete the item you just created.

Image reference:

18.PNG

19.PNG

20.PNG

Please take a try and let me know if you have any question.

 

Best Regards,

Barry

Community Support Team _ Barry
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
Highlighted

Re: Help to get number of items in a list!

You woul have to run an additonal get items with a filter set. Then have two length functions that you can compare.

Highlighted
Community Support
Community Support

Re: Help to get number of items in a list!

Hi @SpDev,

 

I did a test on my side, it seems that it can't use Calculate column in Filter Query.

Maybe you could consider using variables to implement the requirements, initialize a variable of type Integer

Use the value of the week number in the trigger to compare with the week number of all items in the list. If they are equal, the variable is incremented by one.

Finally, compare the value of the variable to greater than 5. If it is greater than 5, delete the item you just created.

Image reference:

18.PNG

19.PNG

20.PNG

Please take a try and let me know if you have any question.

 

Best Regards,

Barry

Community Support Team _ Barry
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

Highlighted
Administrator
Administrator

Re: Help to get number of items in a list!

Hello, @SpDev!

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-bacao-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!
Highlighted
Helper I
Helper I

Re: Help to get number of items in a list!

I'm tying something similar, whenever I create an item to SP, I check if 3 items are already there.

If yes I'd like to remove the newly added item.

The result, however, is that when I add a 4th item, the 3rd gets removed and the 4th added.

What's wrong ?

 

flow.png

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Solution Authors
Users online (7,057)