Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 69iZj+GREteFOeE0Dc+Q/v
Power Automate - General Discussion
Answered

How to get a count of the number of rows returned?

Like (0) ShareShare
ReportReport
Posted on 17 Jul 2017 14:29:39 by 35,130 Super User 2025 Season 1

Is there any direct way to retrieve the number of rows that are returned from a 'get rows' action?

 

This is what I've tried but it results in the error beneath. Ideally, I'd like to avoid looping around the results and incrementing a variable. Thanks!

 

Rowcount.PNG

 

 

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '1590': 'The template language expression 'length(outputs('GetRows').value)' cannot be evaluated because property 'value' doesn't exist, available properties are 'statusCode, headers, body'. Please see https://aka.ms/logicexpressions for usage details.'.

 

Categories:
  • Boru Wang Profile Picture
    4 on 09 Sep 2021 at 05:38:27
    Re: How to get a count of the number of rows returned?

    I tried your method but I only got 5,000 records. My table definitely has more than that. Is this the limitation of Power Automate?

  • timl Profile Picture
    35,130 Super User 2025 Season 1 on 29 Aug 2020 at 11:02:11
    Re: How to get a count of the number of rows returned?

    Thanks for posting this @EdHansberry. Things have changed so I'm sure this will be a great help to others.

  • EdHansberry Profile Picture
    386 on 28 Aug 2020 at 22:26:12
    Re: How to get a count of the number of rows returned?

    I do not think these instructions work anymore. Here is what I did in 2020, 3 years after this was posted, where I am sure things have changed a bit in the product.

    1. Created a Compose step after whatever got the records (SQL Power Query in my case)
    2. in the expression builder, typed Length(
    3. clicked on the body/value in the dynamic section
    4. EdHansberry_0-1598653036272.png

       

    5. Closed the paren.

    that is it. It counts records returning an integer.  A fuller view of the flow:

    EdHansberry_1-1598653533580.png

     

  • Community Power Platform Member Profile Picture
    on 12 Jun 2020 at 10:26:05
    Re: How to get a count of the number of rows returned?

    @v-yamao-msft 

    By any chance can we get current item number/Row number during each iteration ..?

    if yes how can we get during error handling i would like to get each line/row number where/when it throws error.

    you reply would be really appreciated 

  • entropyeater Profile Picture
    9 on 13 Sep 2019 at 19:53:43
    Re: How to get a count of the number of rows returned?

    Thanks! Flow has made getting the length of an array as simple as resetting a lightbulb! https://www.youtube.com/watch?v=1BB6wj6RyKo

  • 980Panama Profile Picture
    140 on 13 Nov 2018 at 22:45:25
    Re: How to get a count of the number of rows returned?

    Very happy to help. Smiley Happy

  • moutinhoabreu Profile Picture
    170 on 13 Nov 2018 at 22:41:25
    Re: How to get a count of the number of rows returned?

    😂

    Yes you were correct.

    Thank you very much.

    I really must invite you one day to support us in our company. 😂

    we use a lot Flow and O365 environment and i'm not a trained It guy

  • 980Panama Profile Picture
    140 on 13 Nov 2018 at 22:25:59
    Re: How to get a count of the number of rows returned?

    The name of the ACTION is Get Rows Invoices (hover over the top of value under dynamic content and it should give you the name it is using). I suspect it is Get_rows_Invoices.  Replace Get_rows with this as in "@length(body('Get_rows_Invoices')?['value'])"  

  • moutinhoabreu Profile Picture
    170 on 13 Nov 2018 at 21:35:02
    Re: How to get a count of the number of rows returned?

    I'm getting this error:

     

    The template validation failed: 'The action(s) 'Get_rows' referenced by 'inputs' in action 'Compose' are not defined in the template.'.

     

     

    Screenshot 2018-11-13 at 21.36.15.png

  • 980Panama Profile Picture
    140 on 13 Nov 2018 at 20:45:14
    Re: How to get a count of the number of rows returned?

    "@length(body('Get_rows')?['value'])" in the compose input. length will give the count of rows.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Automate - General Discussion

#1
stampcoin Profile Picture

stampcoin 25

#2
Pstork1 Profile Picture

Pstork1 22 Most Valuable Professional

#3
David_MA Profile Picture

David_MA 20 Super User 2025 Season 1

Overall leaderboard
Loading started