PW01-L05 · Direct rewrite
Conditional value
Replace SQL IIF with the CEL conditional operator.
ProjectWise-specific
Migration outcomeRewrite a simple branch and recognise the difference between = and ==.
ProjectWise contextGeneral expression in ProjectWise CEL
SQL functionLegacy ProjectWise configurationIIF(500 < 1000, 'YES', 'NO')
500 < 1000 ? 'YES' : 'NO'
What is different
CEL uses condition ? true-value : false-value. The value of the selected branch becomes the result of the expression.
- IIF is a SQL function call, while CEL uses a language operator.
- For equality, CEL uses == rather than SQL =.
- Both branches should return compatible types.
Migration goal
Select one of two values from a boolean condition.
What changes
SQL writes the branch as an IIF call. CEL uses a conditional operator with the condition before the question mark.
Why the CEL solution is clearer
The expression exposes three parts: condition, true result, and false result. In a real rewrite, remember that CEL equality uses ==.
Before deployment
Test both branches. If one branch dereferences a null object, the expression may still fail for a particular input.
Sources
BENTLEY-PW-CEL-SQL-FUNCTIONS — official IIF mapping.