Forum Discussion
LON
9 years agoHelper I
Handling Empty Results
Hi I have a query which returns a list of issues in jason format which I then transform into a table and visualize. The problem is when no rows are returned i.e. no issues - so then there is no ...
- Anonymous9 years ago
LON,
Change your code as follows. And maybe you would need to change List.IsEmpty(content) part in the following code to List.IsEmpty(Source) or List.IsEmpty(body), you can test it.let Source = Json.Document(Web.Contents("https://xxxxxxxxxxxxx", [Headers=[zzzzz="xxxxxx"]])), body = Source[body], content = body[content], #"Converted to Table" = Table.FromList(content, Splitter.SplitByNothing(), null, null, ExtraValues.Error), Table1=Table.FromRecords({ [Column1 = ""] }), result= if List.IsEmpty(content) then Table1 else #"Converted to Table" in result
Regards,
Anonymous
9 years agoNot applicable
LON,
Change your code as follows. And maybe you would need to change List.IsEmpty(content) part in the following code to List.IsEmpty(Source) or List.IsEmpty(body), you can test it.
let
Source = Json.Document(Web.Contents("https://xxxxxxxxxxxxx", [Headers=[zzzzz="xxxxxx"]])),
body = Source[body],
content = body[content],
#"Converted to Table" = Table.FromList(content, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Table1=Table.FromRecords({
[Column1 = ""]
}),
result= if List.IsEmpty(content) then Table1 else #"Converted to Table"
in
result
Regards,
mauryavijai
5 years agoFrequent Visitor
This is not working. In my case from Source = Json.Document(Web.Contents("https://api.abcxyz.com/v2/data_check?request_key=abcxyz12345")) is not giving any results.
is there any way to handle the no result so that we can avoid the "DataFormat.Error: We reached the end of the buffer." on the PowerBI model refresh.
we can show blank data.