You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
12
+
Displays the column, if the column exists. Otherwise, it returns the default column.
13
13
14
14
> **Deprecated aliases:** columnifexists()
15
15
@@ -23,21 +23,40 @@ Takes a column name as a string and a default value. Returns a reference to the
23
23
24
24
| Name | Type | Required | Description |
25
25
|--|--|--|--|
26
-
|*columnName*|`string`|:heavy_check_mark:| The name of the column to check if exists.|
27
-
|*defaultValue*| scalar |:heavy_check_mark:| The value to use if the column doesn't exist. This value can be any scalar expression. For example, a reference to another column.|
26
+
|*columnName*|`string`|:heavy_check_mark:| The name of the column to return.|
27
+
|*defaultValue*| scalar |:heavy_check_mark:| The default column to return if *columnName*doesn't exist in the table. This value can be any scalar expression. For example, a reference to another column.|
28
28
29
29
## Returns
30
30
31
-
If *columnName* exists, then the columnit refers to. Otherwise *defaultValue*.
31
+
If *columnName* exists, then returns the column. Otherwise, it returns the *defaultValue* column.
32
32
33
33
## Example
34
34
35
+
This example returns the default **State** column, because a column named Capital doesn't exist in the *StormEvents* table.
36
+
35
37
:::moniker range="azure-data-explorer"
36
38
> [!div class="nextstepaction"]
37
-
> <ahref="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA03NSwrCQBAE0L2nKGajQiCHEE8Q9zImFWyZTIfpTnTh4Y1f3HVBveq6xuHMwrUhK1pN05ARdnEUjylAltC4lmE/M7uFCv5s91r4OtF4dH7dVVLCiZiM3ULNGbvVH8cdY9ELW/+Io/S8ibltfi+r9+T2AZ+ufQiZAAAA"target="_blank">Run the query</a>
39
+
> <ahref="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAwsuyS%2FKdS1LzSspVqhRKCjKz0pNLlFIzs8pzc2Lz0xLrcgsLinWUHJOLMgsScxR0lEILkksSdUEAKw3fkE3AAAA"target="_blank">Run the query</a>
38
40
::: moniker-end
39
41
40
42
```kusto
41
-
// There's no column "Capital" in "StormEvents", therefore, the State column will be used instead
0 commit comments