Skip to content

Commit fbabe4d

Browse files
author
Jill Grant
authored
Merge pull request #6518 from ktalmor/wi-354388-add-note
added note (line 34)
2 parents fcf2655 + da96372 commit fbabe4d

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

data-explorer/kusto/query/arg-min-aggregation-function.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ StormEvents
5353
| summarize arg_min(BeginLat, BeginLocation) by State
5454
```
5555

56+
**Output**
57+
5658
The results table shown includes only the first 10 rows.
5759

5860
| State | BeginLat | BeginLocation |
@@ -84,6 +86,8 @@ StormEvents
8486
| summarize arg_min(StartTime, *) by State
8587
```
8688

89+
**Output**
90+
8791
The results table shown includes only the first 10 rows and first 3 columns.
8892

8993
| State | StartTime | EndTime | ... |
Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
title: column_ifexists()
3-
description: Learn how to use the column_ifexists() function to return a reference to the column if it exists.
3+
description: Learn how to use the column_ifexists() function to return a reference to the column if it exists.
44
ms.reviewer: alexans
55
ms.topic: reference
6-
ms.date: 08/11/2024
6+
ms.date: 01/09/2025
77
---
88
# column_ifexists()
99

1010
> [!INCLUDE [applies](../includes/applies-to-version/applies.md)] [!INCLUDE [fabric](../includes/applies-to-version/fabric.md)] [!INCLUDE [azure-data-explorer](../includes/applies-to-version/azure-data-explorer.md)] [!INCLUDE [monitor](../includes/applies-to-version/monitor.md)] [!INCLUDE [sentinel](../includes/applies-to-version/sentinel.md)]
1111
12-
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.
1313

1414
> **Deprecated aliases:** columnifexists()
1515
@@ -23,21 +23,40 @@ Takes a column name as a string and a default value. Returns a reference to the
2323

2424
| Name | Type | Required | Description |
2525
|--|--|--|--|
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.|
2828

2929
## Returns
3030

31-
If *columnName* exists, then the column it refers to. Otherwise *defaultValue*.
31+
If *columnName* exists, then returns the column. Otherwise, it returns the *defaultValue* column.
3232

3333
## Example
3434

35+
This example returns the default **State** column, because a column named Capital doesn't exist in the *StormEvents* table.
36+
3537
:::moniker range="azure-data-explorer"
3638
> [!div class="nextstepaction"]
37-
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA03NSwrCQBAE0L2nKGajQiCHEE8Q9zImFWyZTIfpTnTh4Y1f3HVBveq6xuHMwrUhK1pN05ARdnEUjylAltC4lmE/M7uFCv5s91r4OtF4dH7dVVLCiZiM3ULNGbvVH8cdY9ELW/+Io/S8ibltfi+r9+T2AZ+ufQiZAAAA" target="_blank">Run the query</a>
39+
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAwsuyS%2FKdS1LzSspVqhRKCjKz0pNLlFIzs8pzc2Lz0xLrcgsLinWUHJOLMgsScxR0lEILkksSdUEAKw3fkE3AAAA" target="_blank">Run the query</a>
3840
::: moniker-end
3941

4042
```kusto
41-
// There's no column "Capital" in "StormEvents", therefore, the State column will be used instead
4243
StormEvents | project column_ifexists("Capital", State)
4344
```
45+
46+
**Output**
47+
48+
This output shows the first 10 rows of the default **State** column.
49+
50+
| State |
51+
|-------|
52+
| ATLANTIC SOUTH |
53+
| FLORIDA |
54+
| FLORIDA |
55+
| GEORGIA |
56+
| MISSISSIPPI |
57+
| MISSISSIPPI |
58+
| MISSISSIPPI |
59+
| MISSISSIPPI |
60+
| AMERICAN SAMOA |
61+
| KENTUCKY |
62+
| ... |

0 commit comments

Comments
 (0)