Skip to main content

Notifications

Community site session details

Community site session details

Session Id : VtXiMcwyWC93iAt7kFir02
Power Automate - Power Automate Desktop
Unanswered

Gettting Number of Rows in a custom object

Like (0) ShareShare
ReportReport
Posted on 13 Oct 2023 19:35:06 by 431

I have a variable PeopleDataTable that i set equal to a json custom object.

I am trying to get the number of rows in  PeopleDataTable. I have tried PeopleDataTable.RowsCount and PeopleDataTable.Count but in both cases I get an error stating that PeopleDataTable doesn't have that property. Please advise. TIA

  • Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 18 Oct 2023 at 03:17:01
    Re: Gettting Number of Rows in a custom object

    I believe we had already discussed this in a previous topic? You may need to convert %result% to a custom object, because it for some reason is not converted when you converted the entire Answer object.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Steve48 Profile Picture
    431 on 17 Oct 2023 at 19:32:30
    Re: Gettting Number of Rows in a custom object

    Hi @Agnius Apparently result is just a string

    Steve48_0-1697571127832.png

     

  • Steve48 Profile Picture
    431 on 17 Oct 2023 at 18:13:01
    Re: Gettting Number of Rows in a custom object

    Hi @Agnius I tried this but got an error stating that result doesn’t have a property of 2. —I used quotes. Tried both single and double quotes. For now I have a workaround in which i am able to determine the number of { in result. This works.

  • Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 17 Oct 2023 at 12:00:17
    Re: Gettting Number of Rows in a custom object

    Well, key 2 is actually a list. So, it is in fact iterable and does have a .Count property.

    The right way to get it is by doing %result['2'].Count%.

    Note the quotes around 2 there - these are because 2 is a literal name of the property, and not an index. If you do %result[2].Count%, it will fail, because it will think you're trying to access a value at index 2, which is not possible in custom objects (aka dictionaries).

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Steve48 Profile Picture
    431 on 16 Oct 2023 at 22:05:45
    Re: Gettting Number of Rows in a custom object

    Hi @Agnius @Srini007  @Nived_Nambiar This is what the string looks like. I only want to know how many dictionaries there are in key 2.  

    result = {
    "1": "xxxxx",
    "2": [
        {
            "full_name": "xxx",
            "first_name": "xxx",
            "last_name": "xxx",
            "full_address": "xxx",
            "city": "xxx",
            "state": "xx",
            "zip_code": "xxxxx",
            "street_address_without_city_state_zip_code": "xxx",
            "status": "xxxxx"
        },
        {
            "full_name": "xxx",
            "first_name": "xxx",
            "last_name": "xxx",
            "full_address": "xxx",
            "city": "xxxx",
            "state": "xx",
            "zip_code": "xxxxx",
            "street_address_without_city_state_zip_code": "xxx",
            "status": "xxxxx"
        },
        {
            "full_name": "xxx",
            "first_name": "xxx",
            "last_name": "xxx",
            "full_address": "xxx",
            "city": "xxxxxx",
            "state": "xx",
            "zip_code": "xxxxx",
            "street_address_without_city_state_zip_code": "xxx",
            "status": "xxxxx"
    }
    ]
  • Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 16 Oct 2023 at 10:40:21
    Re: Gettting Number of Rows in a custom object

    A custom object is not iterable, it is not a list nor a table. You cannot get the count of objects inside it. The only way to really do it would be to convert it to a string (via Convert custom object to JSON) and then use Parse text to get the number of certain strings in it. Alternatively, you could try passing it to a Python/C# script and use scripting to get the count of items, but that would be tricky, as the syntax is not exactly the same.

     

    If you want us to come up with the pattern to use in Parse text, please provide a sample of the JSON string.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • SriniK Profile Picture
    3,025 Super User 2025 Season 1 on 15 Oct 2023 at 15:22:44
    Re: Gettting Number of Rows in a custom object

    Hi @Steve48 

     

    Are you trying to get the rows from Datatable? Then you have the Row.count Option, but as you said it's a JSON custom object so JSON don't have Rows. For more suggestion It would be great if you can share a sample JSON, according to the sample you shared we can suggest you next steps

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Thanks,

    Srini

  • Nived_Nambiar Profile Picture
    17,534 Super User 2025 Season 1 on 14 Oct 2023 at 06:19:00
    Re: Gettting Number of Rows in a custom object

    Hi @Steve48 

     

    for clarity, could you show how your JSON String looks like ?

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

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

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard