question

SchoutsenDennis-0538 avatar image
0 Votes"
SchoutsenDennis-0538 asked saldana-msft edited

Error handeling empty parameter in KQL

I created an interactive Azure Workbook where I use the option 'When items are selected, export parameters' to passthrough the selection to a Detail grid in another part of the workbook. for example: I select an Azure Region on the map and the resources in that region are shown in the Detail grid. So far so good.

The issue I haven't yet resolved is that when no selection is made (on initial opening the workbook) the parameter is empty and the query returns an error.
"Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying. ParserFailure..."

Can anybody help me with a solution?

The query looks like this, where {SelectedLocations} is the parameter passthrough from another part of the Workbook:

 resources
 | where location in ({SelectedLocations})
 | join kind=inner (
     resourcecontainers
     | where type == 'microsoft.resources/subscriptions'
     | project subscriptionId, subscriptionName = name
 ) on subscriptionId
 | extend details = pack_all()
 | project id, type, location, subscriptionName, details
 | order by location

As soon as the {SelectedLocations} has a value the query returns desired results.


microsoft-graph-explorermicrosoft-graph-workbooks
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can we use isempty function and iif to determine when the SelectedLocations parameter is empty then we can assign a default value to it?
eg. | where location in (iif(isempty({SelectedLocations}),"East US",{SelectedLocations})).

0 Votes 0 ·

Hi, Thanks for your suggestion but unfortunately it is no solution. ![115534-image.png][1] [1]: /answers/storage/attachments/115534-image.png

0 Votes 0 ·

Sorry for the late reply. Is this an error that is not supported by the grammar?

0 Votes 0 ·
Show more comments

this topic is for ms graph API questions.

0 Votes 0 ·

0 Answers