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

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

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

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

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
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager
Power Platform Communities
Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (9,497)