cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

How do I get a count of values in a SharePoint item multi-select lookup column

Hi folks,

I have a SharePoint list which records details about payment requests. There is a lookup field which allows multiple values for Child Name, and there is a Total Amount field. I have a flow which gets the values of the multi-value lookup field and writes just the names to approval email (along with some other fields).

 

What I want to do now is get a count of those names so I can update the SharePoint list item column "Total Children" with that number, so that I can use that to divide the Total Amount by the Total Children.

 

I cannot figure out how to get that count.  Below is a screen shot of the current flow. I assume I need to initiate another integer variable, then use an Apply to Each to increment that variable, but I cannot figure out the process.

 

 

flow-shot.png

 

Can someone give me a clue how to add the extra bits to the flow to get that count?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How do I get a count of values in a SharePoint item multi-select lookup column

Hi @emjem ,

 

Since the value of the output of this field is an array, you could use length() function to get the number of array elements, and then determine Total Amount.

 

Suppose I have a lookup column named Child Name and support multiple selections. We can configure the Expression as shown below to get the count.

 

length(triggerBody()?['Child_x0020_Name'])

Image reference:

 

63.PNG62.PNG

 

Hope it helps.

 

Best Regards,

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

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: How do I get a count of values in a SharePoint item multi-select lookup column

Hi @emjem ,

 

Since the value of the output of this field is an array, you could use length() function to get the number of array elements, and then determine Total Amount.

 

Suppose I have a lookup column named Child Name and support multiple selections. We can configure the Expression as shown below to get the count.

 

length(triggerBody()?['Child_x0020_Name'])

Image reference:

 

63.PNG62.PNG

 

Hope it helps.

 

Best Regards,

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
Regular Visitor

Re: How do I get a count of values in a SharePoint item multi-select lookup column

Is the solution mentioned below already solved?

 

I am having the same problem.

 

Thanks.

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