The if statement will stop on the first match, and as the Flux team describes it "short circuit when possible". For example, given this Flux:
|> map(fn: (r) => ({ // Retain all existing columns in the mapped row r with // Set the level column value based on the _value column level: if r._value >= 95.0000001 then "critical" else if r._value >= 85.0000001 "warning" else if r._value >= 70.0000001 then "high" else "normal" })
Where r._value is 96, then the output would be "critical" because the if statement would match on the first line and then stop.
While this is possible to test and work out I think it should be explicitly mentioned in the docs.
URL for relevant page?
https://docs.influxdata.com/flux/v0.65/guides/conditional-logic/
What products and version are you using?
Flux
Where did you look before opening the issue?
Docs and Slack
The if statement will stop on the first match, and as the Flux team describes it "short circuit when possible". For example, given this Flux:
|> map(fn: (r) => ({ // Retain all existing columns in the mapped row r with // Set the level column value based on the _value column level: if r._value >= 95.0000001 then "critical" else if r._value >= 85.0000001 "warning" else if r._value >= 70.0000001 then "high" else "normal" })
Where r._value is 96, then the output would be "critical" because the if statement would match on the first line and then stop.
While this is possible to test and work out I think it should be explicitly mentioned in the docs.