![]() |
![]() |
|
| Home I Company I Services I Documentation I Downloads I E-Support |
| home -> documentation -> language reference -> expression property | |||
|
This property allows the evaluation of mathematical expressions. The expressions could be of two kinds: arithmetic or Boolean. Variables are also supported inside the expressions. There are two ways to set variables: as parameters passed directly to the page by the URL or variables set before the expression be evaluated using the SETCOOKIE tag. In addition, if the expression is contained inside a DATASET block, all the field names will become automatically available as variables for its immediate use and the values of these variables will correspond to the values contained in the current record.
This property is commonly used for dynamic calculation inside a DBSP page: sums, formulas, statistics and so on. You can also use a variety of mathematical functions described here. The expression property is used in the DBSP tags:SETCOOKIE EXPVAL IF WHILE FUNCTIONS Notice that the result of the evaluation and the destiny of the value will depend on the tag and context of the command. For example, if the expression is used in the EXPVAL tag, the result will be replaced instead the tag. If the expression is used inside the SETCOOKIE tag, then the resulting value will be set as the value for the referenced cookie. If the expression is used inside the IF tag or WHILE tag, then the control flow will depend of the Boolean value of the result (True or false).
Example 1. Using expressions inside cookies. This example shows how to calculate arithmetic expressions and store the result into a cookie for later use. Source code
Test example
Example 2. Using expressions inside IF tags. This example shows how to insert a block of code depending on the value of a Boolean expression. Source code
Test example
|