web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / The template language ...
Power Automate
Answered

The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Null'.

(1) ShareShare
ReportReport
Posted on by 377

Sorry I have googled and seen a solution that is not working for me.

 

I am trying to find the number of matches in an SPO list.

 

I use the expression ... 

length(body('GetFilesPO')?['body/value'])
 
but I get the error 
The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Null'.
 
Thanks
P

 

 

flow error 1.png
Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,499 on at

    Hey @pmwhelan 

     

     

    There may be many moments when you will get null values. For this I would suggest you to use the following expression:

    if(equals(length(body('GetFilesPO')?['body/value']),null),0,length(body('GetFilesPO')?['body/value']))

     

    Or the below expression:

     

     

    if(equals(body('GetFilesPO')?['body/value'],null),0,length(body('GetFilesPO')?['body/value']))

     

     

    So, I am checking if the above expression is equal to null or nor, if it equals null, then give length 0, otherwise the normal value.

     

    Hopefully this will work.

     

    If this works for you, you can marks this as a solution. You can give a thumbs up as well. 🙂

  • Verified answer
    v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @pmwhelan ,

    Do you want to get the number of files under the folder?

    Please try changing the formula to:
     

     

    length(outputs('GetFilesPO')?['body/value'])

     

    vdezhilimsft_0-1668498411546.png
    vdezhilimsft_1-1668498411547.png
    vdezhilimsft_2-1668498411548.png
    Best regards,
    Dezhi
  • ST-01041904-0 Profile Picture
    Microsoft Employee on at
    This expression is not working 

    length(body('Location')?['value'])

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 523

#2
Valantis Profile Picture

Valantis 318

#3
David_MA Profile Picture

David_MA 235 Super User 2026 Season 1

Last 30 days Overall leaderboard