Set a True Value and a False Value In One Condition
The If() function can be used to test conditions without creating separate rules. It can be used anywhere that a Boolean condition can be used, including in entity and temporal functions.
The If() function returns one of two values, depending on whether a condition is true or false. The If() function uses the following syntax:
- If(<Boolean attribute>, <value-if-true>, <value-if-false>)
Example 1:
the person’s income = If(the person is an employee, 100000, 0)
would infer the following values:
| the person's income | the person is an employee |
|---|---|
| 100000 | true |
| 0 | false |
| uncertain | uncertain |
| unknown | unknown |
Example 2:
the person’s income = If(the person is an employee, the employment income, the contractor income)
would infer the following values:
| the person's income | the person is an employee | the employment income | the contractor income |
|---|---|---|---|
| 100000 | true | 100000 | unknown |
| 55000 | false | unknown | 55000 |
| uncertain | uncertain | unknown | unknown |
| unknown | unknown | unknown | unknown |