Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions apl/scalar-functions/conditional-function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ keywords: ['axiom documentation', 'documentation', 'axiom', 'case', 'iff']

| **Function Name** | **Description** |
| ----------------- | ------------------------------------------------------------------------------------------------- |
| [case()](#case) | Evaluates a list of conditions and returns the first result expression whose condition is satisfied. |
| [iff()](#iff) | Evaluates the first argument (the predicate), and returns the value of either the second or third arguments |
| [case](#case) | Evaluates a list of conditions and returns the first result expression whose condition is satisfied. |
| [iff](#iff) | Evaluates the first argument (the predicate), and returns the value of either the second or third arguments |

## case()
## case

Evaluates a list of conditions and returns the first result whose condition is satisfied.

Expand Down Expand Up @@ -49,7 +49,7 @@ extend status_human_readable = case(

[Run in Playground](https://play.axiom.co/axiom-play-qf1k/query?initForm=%7B%22apl%22%3A%22%5B'sample-http-logs'%5D%5Cn%7C%20extend%20status_code%20%3D%20case(status_int%20%3D%3D%20200%2C%20'OK'%2C%20status_int%20%3D%3D%20201%2C%20'Created'%2C%20status_int%20%3D%3D%20301%2C%20'Moved%20Permanently'%2C%20status_int%20%3D%3D%20500%2C%20'Internal%20Server%20Error'%2C%20'Other')%22%7D)

## iff()
## iff

Evaluates the first argument (the predicate), and returns the value of either the second or third arguments. The second and third arguments must be of the same type.

Expand All @@ -76,4 +76,12 @@ iff(predicate, ifTrue, ifFalse)
| project Status = iff(req_duration_ms == 1, "numeric", "Inactive")
```

[Run in Playground](https://play.axiom.co/axiom-play-qf1k/query?initForm=%7B%22apl%22%3A%22%5B'sample-http-logs'%5D%5Cn%7C%20project%20Status%20%3D%20iff%28req_duration_ms%20%3D%3D%201%2C%20%5C%22numeric%5C%22%2C%20%5C%22Inactive%5C%22%29%22%7D)
[Run in Playground](https://play.axiom.co/axiom-play-qf1k/query?initForm=%7B%22apl%22%3A%22%5B'sample-http-logs'%5D%5Cn%7C%20project%20Status%20%3D%20iff%28req_duration_ms%20%3D%3D%201%2C%20%5C%22numeric%5C%22%2C%20%5C%22Inactive%5C%22%29%22%7D)

<Note>
To return a null value from `iff`, use `dynamic(null)`.

```kusto
iff(condition, dynamic(null), value)
```
</Note>