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
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.
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.
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.
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.
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.
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
Hi @Steve48
for clarity, could you show how your JSON String looks like ?
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! 🙌
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional