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
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 🙂
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 |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
126 | |
106 | |
105 | |
86 | |
72 |