Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi
I am trying to get records from а web-service
Using this code I have got an error
Unable to convert a value of type List in the Record Type.
let #"campaignsId_List"= Table.FromList(Table.Column(campaigns, "campaignId"), null, {"campaignId"}, null, null), Ссылка = "campaigns/statistics/balance?query[campaignId]=PGp8n", #"Запрос http" = Table.AddColumn(#"campaignsId_List", "responseJson", each Record.ToTable( Json.Document(Web.Contents(URL & Ссылка & [campaignId], [Headers=[#"X-Auth-Token"="api-key "& Token, #"X-Domain"= Domain , #"Content-Type"="application/json"]])))) in #"Запрос http"
What is а cause of this error?
Solved! Go to Solution.
Had a closer look at your code and to me it looks as if you need to remove Errors from your column "responseJSON" (check the column -> righclick with mouse -> select "Remove Errors".
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
It could be that the Json.Document doesn't return a record, but a list instead.
Try the expression without the "Record.ToTable"-conversion and check the format of the returned Json.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Yes, you can use if .. then (for conditions) or try ... otherwise (as the error-handler).
What exactly shall happen: Skip the step & continue with the previous step instead or return a default-value?
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
ImleF, I need use "Skip the step & continue with the previous step"
Here is screen http://prntscr.com/drxkgm
Please help add this check to the code
let #"campaignsId_List"= Table.FromList(Table.Column(campaigns, "campaignId"), null, {"campaignId"}, null, null), Ссылка = "campaigns/statistics/balance?query[campaignId]=", #"Запрос http" = Table.AddColumn(#"campaignsId_List", "responseJson", each Record.ToTable( Json.Document(Web.Contents(URL & Ссылка & [campaignId], [Headers=[#"X-Auth-Token"="api-key "& Token, #"X-Domain"= Domain , #"Content-Type"="application/json"]])))) in #"Запрос http"
Had a closer look at your code and to me it looks as if you need to remove Errors from your column "responseJSON" (check the column -> righclick with mouse -> select "Remove Errors".
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
ImkeF, yes, it works!
Thank You 🙂
User | Count |
---|---|
98 | |
90 | |
82 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
67 |