diff --git a/apl/scalar-functions/conditional-function.mdx b/apl/scalar-functions/conditional-function.mdx index 50b18f39..774e5024 100644 --- a/apl/scalar-functions/conditional-function.mdx +++ b/apl/scalar-functions/conditional-function.mdx @@ -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. @@ -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. @@ -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) \ No newline at end of file +[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) + + +To return a null value from `iff`, use `dynamic(null)`. + +```kusto +iff(condition, dynamic(null), value) +``` + \ No newline at end of file