column_ifexists()
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Takes a column name as a string and a default value. Returns a reference to the column if it exists, otherwise - returns the default value.
Deprecated aliases: columnifexists()
Syntax
column_ifexists(
columnName,
defaultValue)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
columnName | string |
✔️ | The name of the column to check if exists. |
defaultValue | scalar | ✔️ | The value to use if the column doesn't exist. This value can be any scalar expression. For example, a reference to another column. |
Returns
If columnName exists, then the column it refers to. Otherwise defaultValue.
Example
// There's no column "Capital" in "StormEvents", therefore, the State column will be used instead
StormEvents | project column_ifexists("Capital", State)