FORMULA LANGUAGE


Examples: Performing arithmetic operations
1. (*, precedence) This example prints 15 for the first @Prompt because the multiplication 4 * 3 is evaluated first. It prints 21 for the second @Prompt because the parentheses force the evaluation of 3 + 4 first.
2. (/ *) This example prints 0.333333333333333 for the first @Prompt, performing the division and rounding the result to 15 decimal places. It prints 1.2635268885E+17 for the second @Prompt, presenting the 11 most significant digits of the result as a fraction multiplied by 1017.
3. (@Abs) This example calculates the difference between Score1 and Score2 as an unsigned number, no matter which is larger.
4. (@Abs) This example calculates the absolute difference between Sales and CostOfSales, and formats it in a text field placing parentheses around a negative result.
5. (@Sign) This agent example displays the Total field. If the field value is negative, its absolute value is placed in parentheses; if the field value is zero, the word "Zero" is displayed.
6. (@Sum) This example prints 15, the sum of the list One23, the variable Four, and the constant 5.
7. (@Integer) This example truncates 3.12 to 3 and 6.735 to 6.
8. (@Integer) This example truncates Sales and Commission to integers in a list.
9. (@Round) This example rounds 3.12 to 3, 6.735 to 7, and 7.5 to 8; 753 by tens to 750; and the list elements 3.12, 6.735, and 7.5 to 3, 6, and 7 respectively (converting them to a text string for display).
10. (@Max) This example prints 99, the maximum of 99, 2, and 3; 3, the maximum of 1 and 3; and 99 6 7 8, the maximum of the pair-wise elements in the two lists.
11. (@Min) This example prints 2, the minimum of 99, 2, and 3; 1, the minimum of 1 and 3; and 5 2 3 3, the minimum of the pairwise elements in the two lists.
12. (@Modulo) This example prints 1, the remainder of 4/3; -2, the remainder of -14/3 (the remainder is negative when the dividend is negative); and 1 2 3 3, the remainders of the pairwise division of the first list by the second in the third line.
13. (@Modulo) This example determines if the input number is even (division by 2 leaves a remainder of 0) or odd.
14. This example compares the fields SpecifiedLength and MeasuredLength, and displays a message if the fields are not within 0.01.
15. (@Power) This example prints 8, 2 raised to the power of 3; -8, -2 raised to the power of 3; and 0.125, 2 raised to the power of -3.
16. (@Sqrt, @Power) This example, which is the value formula for a computed field, calculates the diagonal of a rectangle using the values specified in the Length and Width fields.
17. (@Pi, @Power) This example, which is the value formula for a computed field, calculates the area of a circle using the values specified in the Radius field.
18. (@Log) This example prints 0.602059991327962, the common logarithm of 4; and 14, the common logarithm of 1014.
19. (@Ln) This example prints 0.693147180559945, the natural logarithm of 2.
20. (@Exp) This example calculates 2.71828182845904 (the value of e) for the first @Exp function, 3.49034295746184 (the value of e to the 1.25) for the second @Exp function, and 0.28650479686019 (the value of e to the -1.25) for the third @Exp function.
21. (@Random) This view action example gets a number from a user and compares it to a random number in the range 1 through 99, inclusive.
22. (@Sin, @Cos) This example shows the formulas for two computed fields. The first formula calculates the length of a rectangle and the second formula calculates its width.
See Also