Forum Discussion
[Expression.Error] We cannot convert a value of type List to type Record.
Thanks in regards to where I am and the code source this is the resource I used
https://stackoverflow.com/questions/46904641/how-to-get-paginated-data-from-api-in-power-bi
Hello Anonymous
this could get nasty and without nowing the datasource (data elaborated by the getpage-function) is almost inpossible to help. If your Json-data however comes in formated in a way data for some field you have a record and list, you could make a Table.TransformColumns with Table.ExpandTableColumn instead of usind only Table.ExpandRecordColumm. Here a practicable example
let
Source = Json.Document("[{""a"":2},[""a;2""]]#(cr)#(lf)"),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
TransformColumns = Table.TransformColumns
(
#"Converted to Table",
{
{
"Column1",
each if Value.Is(_, type list) then Table.FromRecords({Record.FromList({List.Transform(_, each Text.Split(_,";")){0}{1}},{List.Transform(_, each Text.Split(_,";")){0}{0}})},null,MissingField.Error) else if Value.Is(_, type record) then Table.FromRecords({_},null,MissingField.Error) else null
}
}
),
#"Expanded Column1" = Table.ExpandTableColumn(TransformColumns, "Column1", {"a"}, {"a"})
in
#"Expanded Column1"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
- edhans5 years agoCommunity Champion
Absolutely Anonymous- always good to give kudos to posts that are helpful. 👍😁
sorry couldn't be more help. It is difficult to troubleshoot shoot errors on a forum and even more so when it is the result of nested tables, lists, and records.
- Anonymous5 years agoNot applicable
I must admit this is getting abit above me at the mo and I will need to go back and take on board all suggested here, I would like to say thanks to both for the help and guidance provided so what is the best way to the thanks to the both of you - click the kudos button on different posts?
- Anonymous5 years agoNot applicable
You are using a list as your parameter for the getpage() function [Column1]. You could probably just do Table.AddColumn(PriorStep, "Page", each [Column1])
- Anonymous5 years agoNot applicable
Hi thanks for the reply, is that in reference to line 6 #"Converted to Table" or line 7 #"Expanded Column1" - please?
- Icey5 years agoCommunity Support
Hi Anonymous ,
Based on the current information, I cannot reproduce your issue. It is suggest to provide more information to help me better understand the issue you are experiencing.
Best Regards,
Icey