Why? |
Sometimes you want an attribute (or a filter) that requires an if-statement. For example, you may want to have a new variable that's "fast" if the speed is over 500 mph, and "slow" if it's not. Conditional expressions are perfect for this. |
In the formula editor, type "if ( " (no quotes). You'll see this:
You need to type a Boolean expression (something that is either true or false) inside the parentheses. Then, press tab or select one of the question marks. The top one is what you get if the expression in parentheses is true; you get the bottom one if it's false. Here is our example:
Your result does not have to be a string. It can be a number, too. You may also nest if-statements.