|
Conditional expressions use a simple syntax made up of operators such as = and !=, operands, and logical connectors such as && and ||. Operands may be literal numeric, alphanumeric, or text string values, @variables, @data-fields, or functions . In scripts , literal string operands may be enclosed in double quotes (") (but no quotes may be used in ploticus select: attributes) . There is no concept of precedence in these expressions (other than left to right); parentheses cannot be used except within strings.
Examples- In a script , see if the value of the variable @SUM is greater than 100: #if @SUM > 100 ... #endif - Another example: #if @SUM > 100 && @STATUS = s - Check to see if @description has any contents: #if $len(@description) > 0 - Check to see if @val is a valid number: #if $isnumber(@val) = 1 - See if @C does not countain a double quote: #if @C != "\"" Here's a conditional expression for finding lastname beginning with Gr, Gu or Gy: @lastname inlike Gr*,Gu*,Gy* OperandsOperands may be
In
scripts
, literal alphanumeric, text string, or
commalist
operands may be enclosed in double quotes (");
no variable evaluation occurs inside quoted strings.
Comparison operators
Wild card matching: Wild card matching may be done using like. Wild card characters are * which matches any number of any character, and ? which matches a single instance of any character. This matching is case-insensitive.
Commalist operators: these take a commalist on the right side. By default, lists are delimited using commas. If this is not convenient, the list delimitation character may be changed using #control listsep .
Logical connectorsIndividual conditional expressions may be connected together using logical AND (&&) or OR (||). An entire expression may be negated by putting not: at the beginning of the expression.
Because parentheses may not be used to establish precedence
mixing AND and OR in the same expression requires care.
When the expression is parsed, it is first
split into OR terms, then each of the OR terms is split into AND terms.
For example: A = B and C = D or E = E of F = G would evaluate to true,
because it is interpreted as if it were written
(a = B and C = D) or (e = e) or (f = g).
It may be best to avoid mixing AND and OR in the same expression
and use multiple expressions instead.
Limitations and bugs
Because parentheses may not be used to establish precedence,
the mixing of AND and OR in the same expression is problematic (see above).
|
![]() data display engine Copyright Steve Grubb ![]() |