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

Count number of items in array

Hi guys,

 

I have body/item from the "filter array" action and i can't seem to count the number of items in the array.

 

The output from "filter array" seems to be either item or body. So i tried using Body with the "compose" action.

 

length(variable('Body'))

 

However, it gives me an error msg for the compose action.

 

Unable to process template language expressions in action 'Compose' inputs at line '1' and column '15082': 'The template function 'variable' is not defined or not valid.'.

 

Reference:

https://powerusers.microsoft.com/t5/Building-Flows/Count-items-in-array/m-p/344340#M37785

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

It's because you need to count the length of the output of the filter array, not your original array variable containing the items, something like this might work for you:

length(body('Filter_array'))

View solution in original post

1 REPLY 1
Paulie78
Super User
Super User

It's because you need to count the length of the output of the filter array, not your original array variable containing the items, something like this might work for you:

length(body('Filter_array'))

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,986)