Progress
Report Builder
User’s Guide
Order of Expression Evaluation
Report Builder evaluates expressions using the following rules:
- Report Builder performs the operations within parentheses first. For example, the result of 1 + 4 / 2 is 3, but the result of (1 + 4) / 2 is 2.5 because Report Builder performs the operation in parentheses first.
- If parentheses are nested or embedded, as in the expression 3 * ((1 + 4) / 2), Report Builder performs the operation in the most deeply embedded parentheses first. In this case, the first operation is 1 + 4, resulting in 5, the second is 5 / 2, resulting in 2.5, and the third is 3 * 2.5, resulting in 7.5.
- If an expression contains several operators that have the same precedence, Report Builder performs the operations from left to right. For example, the expression 1 + 4 / 2 * 6 / 3 is equivalent to 1 + ( ( 4 / 2 ) * 6) / 3 ) ). Report Builder performs the division and multiplication operations left to right before performing the addition operation. The first operation is 4/2, resulting in 2; the second operation is 2*6, resulting in 12; the third operation is 12/3, resulting in 4; the last operation is 1+4, resulting in 5.
The < and > operators are in the next level of precedence, so Report Builder performs them second; the logical OR is in the lowest level of precedence and, therefore, performed last. Report Builder evaluates the expression 12 < 8 OR 4 > 5as if it were ((12 < 8) OR (4 > 5)).
For example, Report Builder evaluates the following expression as false, because the * and + operations are performed first:
In the following expression, Report Builder evaluates the > operators first. Both conditions must be true for the expression to be true. The balance must be greater than 100 and the number of days must be greater than 30:
In the following expression, Report Builder adds TODAY+30 first and then compares the result to the date returned by the DATE( ) function. Therefore, the expression is true only when TODAY+30 results in a date that is later than 7/1/93:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |