Forum Discussion
skip query step if condition is met
- 1 year ago
Thanks for the help. I found the solution I was looking for. The script should look like the following:
let
Source =
if List.Single(DateList) = null then
Excel.Workbook(File.Contents(""C:\Mydocuments\Test.csv"), null, true)
else
null, // Preventing further steps if Source is null
Output =
if Source = null then
#table({}, {}) // Returns an empty table
else
let
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", Int64.Type}, {"Code", Int64.Type}, {"Value", Int64.Type}})in
#"Changed Type"in
Output
Hi Phil_Oliveira ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution we provided for your issue worked for you or let us know if you need any further assistance?
Your feedback is important to us, Looking forward to your response.
Thanks for the help. I found the solution I was looking for. The script should look like the following:
let
Source =
if List.Single(DateList) = null then
Excel.Workbook(File.Contents(""C:\Mydocuments\Test.csv"), null, true)
else
null, // Preventing further steps if Source is null
Output =
if Source = null then
#table({}, {}) // Returns an empty table
else
let
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", Int64.Type}, {"Code", Int64.Type}, {"Value", Int64.Type}})
in
#"Changed Type"in
Output