set_has_element()

Applies to: ✅ Azure Data ExplorerAzure MonitorMicrosoft Sentinel

Determines whether the specified set contains the specified element.

Syntax

set_has_element(set, value)

Learn more about syntax conventions.

Parameters

Name Type Required Description
set dynamic ✔️ The input array to search.
value ✔️ The value for which to search. The value should be of type long, int, double, datetime, timespan, decimal, string, guid, or bool.

Returns

true or false depending on if the value exists in the array.

Example

print arr=dynamic(["this", "is", "an", "example"]) 
| project Result=set_has_element(arr, "example")

Output

Result
true

Use array_index_of(arr, value) to find the position at which the value exists in the array. Both functions are equally performant.