Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Checks whether a dynamic property bag object contains a given key.
Syntax
bag_has_key(bag,key)
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| bag | dynamic |
✔️ | The property bag to search. |
| key | string |
✔️ | The key for which to search. Search for a nested key using the JSONPath notation. Array indexing isn't supported. |
Returns
True or false depending on if the key exists in the bag.
Examples
datatable(input: dynamic)
[
dynamic({'key1' : 123, 'key2': 'abc'}),
dynamic({'key1' : 123, 'key3': 'abc'}),
]
| extend result = bag_has_key(input, 'key2')
Output
| input | result |
|---|---|
| { "key1": 123, "key2": "abc" } |
true |
| { "key1": 123, "key3": "abc" } |
false |
The following example searches using a JSONPath key.
datatable(input: dynamic)
[
dynamic({'key1': 123, 'key2': {'prop1' : 'abc', 'prop2': 'xyz'}, 'key3': [100, 200]}),
]
| extend result = bag_has_key(input, '$.key2.prop1')
Output
| input | result |
|---|---|
| { "key1": 123, "key2": { "prop1": "abc", "prop2": "xyz" }, "key3": [ 100, 200 ] } |
true |