Multi-value parameters
A multi-value parameter allows the user to set one or more arbitrary text values. Multi-value parameters are commonly used for filtering, often when a dropdown control might contain too many values to be useful.
Create a static multi-value parameter
Start with an empty workbook in edit mode.
Select Add parameters > Add Parameter.
In the new parameter pane that opens, enter:
- Parameter name:
Filter
- Parameter type:
Multi-value
- Required:
unchecked
- Get data from:
None
- Parameter name:
Select Save to create the parameter.
The Filter parameter will be a multi-value parameter, initially with no values.
You can then add multiple values.
A multi-value parameter behaves similarly to a multi-select dropdown parameter and is commonly used in an "in"-like scenario.
let computerFilter = dynamic([{Computer}]);
Heartbeat
| where array_length(computerFilter) == 0 or Computer in (computerFilter)
| summarize Heartbeats = count() by Computer
| order by Heartbeats desc
Parameter field style
A multi-value parameter supports the following field styles:
Standard: Allows you to add or remove arbitrary text items.
Password: Allows you to add or remove arbitrary password fields. The password values are only hidden in the UI when you type. The values are still fully accessible as a parameter value when referred. They're stored unencrypted when the workbook is saved.
Create a multi-value parameter with initial values
You can use a query to seed the multi-value parameter with initial values. You can then manually remove values or add more values. If a query is used to populate the multi-value parameter, a restore defaults button appears on the parameter to restore back to the originally queried values.
Start with an empty workbook in edit mode.
Select Add parameters > Add Parameter.
In the new parameter pane that opens, enter:
- Parameter name:
Filter
- Parameter type:
Multi-value
- Required:
unchecked
- Get data from:
JSON
- Parameter name:
In the JSON Input text block, insert this JSON snippet:
["apple", "banana", "carrot" ]
All the items that are the result of the query are shown as multi-value items. You aren't limited to JSON. You can use any query provider to provide initial values, but you'll be limited to the first 100 results.
Select Run Query.
Select Save to create the parameter.
The Filter parameter will be a multi-value parameter with three initial values.