This section lists Fathom's conditional functions.
These functions give you different results depending on a condition. Put the condition inside the parentheses. The formula editor will format the various alternatives for you to fill in. You can use conditional functions in formulas for attributes and in formulas for measures.
The if( ) function
The editor gives you a brace and two places for alternatives--the question marks. Put the condition inside the parentheses. The question mark on the top is for when the condition is true. The bottom one is for when it's false. | |
The formula at left gives the string result tall if the attribute height is greater than 100. This is a good formula for an attribute that divides the collection into two categories. | |
This formula would make an attribute with numbers half the row number--but with no fractions. It checks if the caseIndex (the row number) is even. If it is, it divides by two. But if not, it adds one before dividing. |
Note: You can nest if( ) statements.
The switch( ) function
This function is a high-octane nested if( ) function. It starts with two alternatives, but you can add more by pressing the insert key on your keyboard.
When you begin, the editor gives you parentheses with a brace and two alternatives--the question marks after the colons. The one on the top also has a second set of parentheses with another question mark. | |
If you put an attribute in the first parentheses, you can put a value in the second. Then you can put the results you want after the colon. | |
With your cursor to the right of the brace, press the insert key to insert a new possibility. Here, we're classifying states. The else clause works only when none of the others are true. | |
If you don't fill in the first parentheses, put Boolean expressions in the ones to the right of the brace. They work from top to bottom. If you have a building 1400 feet tall and 90 stories, it will be called a skyscraper even though it qualifies for high-ceiling. |