The "Cond()" and "If()" functions let you formulate a wide variety of conditions. The first argument is a logical expression that is evaluated for truth. If the expression is true, the second argument is returned as the result. If the expression is false, the third argument is returned as the result.
A simple example: Let us assume that you want to output the total of the article prices on a page in an invoice footer line. You also want to output the grand total of article prices on the last page.
Figure 10.14: Example of the use of Cond()
You enter this function in the formula wizard either directly in the editing line or via the "Condition" tab.
1. As a "condition" (1st parameter), enter the expression that is to be tested for TRUE or FALSE. In our example, we want to use the "not Lastpage()" function to determine whether this is the last page.
2. As the "expression, if condition is TRUE" (2nd parameter), enter the expression that is to apply if the above condition is TRUE. In our example, the condition is true if this is not the last page and in this case the page total is to be output (parameter of the "Sum()" function is "True").
3. As the "expression, if condition is FALSE" (3rd parameter), enter the expression that is to apply if the above condition is FALSE. In our example, the condition is false if this is the last page and in this case the grand total is to be output (parameter of the "Sum()" function is "False").
4. If you have entered this function via the "Condition" tab, you can use the "Insert" button to add the finished condition to your editing line.