Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I'm using pagination to get data from a REST API. The API works fine but results in like this:
As you see the engagement column contains a List and a Record as well. I would like to convert that record to a list. Any clue how to do that?
After that I can use Table.ExpandListColumn and my code will work fine.
Appreciate any help in this.
Thanks
Ranbeer
Solved! Go to Solution.
Hi Ranbeer,
You can use Value.Is to check if the values in the column are of type record, and if so use Record.ToList to convert the record to a list of field values.
Here's some code that worked for me:
= Table.TransformColumns( PreviousStep, { "engagement", each if Value.Is( _, type record ) then Record.ToList( _ ) else _ } )
Another option is:
= Table.TransformColumns( PreviousStep, { "engagement", each try Record.ToList( _ ) otherwise _ } )
Regards
Owen
Ok, I was able to do this like
Table.TransformColumns( previousStep, { "engagement", each if Value.Is( _, type record ) then { _ } else _ } )
Hi Ranbeer,
You can use Value.Is to check if the values in the column are of type record, and if so use Record.ToList to convert the record to a list of field values.
Here's some code that worked for me:
= Table.TransformColumns( PreviousStep, { "engagement", each if Value.Is( _, type record ) then Record.ToList( _ ) else _ } )
Another option is:
= Table.TransformColumns( PreviousStep, { "engagement", each try Record.ToList( _ ) otherwise _ } )
Regards
Owen
Thanks Owen.
But, what I really wanted was to put that record in a list, and not to convert the record to list of values.
Something like
Current situation:
[Record]
New situation
{List}
Expanding this list should give me the above "[Record]"
[Record]
Do you know how to do that?
Thanks for help.
Ok, I was able to do this like
Table.TransformColumns( previousStep, { "engagement", each if Value.Is( _, type record ) then { _ } else _ } )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
139 | |
100 | |
95 | |
85 | |
63 |