I have a workbook that uses data sources from web (XML query) to pull some info in. The server will return an error if I send a “0” or “blank” for one value, so I am trying to find a way to wrap one of my queries in a conditional if statement
so that the query will only run if there is a positive value in a specific cell (that cell is named SecondSize
if this is helpful). I went to PowerEditor and then to Advanced Editor and have the info below but was unsure where (and how) to place an IF statement here.
let
apiAddress = Excel.CurrentWorkbook(){[Name="ApiUrl2"]}[Content]{0}[Column1],
Source = Json.Document(Web.Contents(apiAddress)),
#"Converted to Table" = Record.ToTable(Source),
Value = #"Converted to Table"{6}[Value],
ac_monthly = Value[ac_monthly],
#"Converted to Table1" = Table.FromList(ac_monthly, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore)
in
#"Converted to Table1"
In a truly ideal world, I would not only skip the query when the value is 0 or blank but I would also overwrite the 12 values in table1 with a “0”…but if that is too much I can do a conditional on another cell to manage that part.