Conditions/Boolean Operations [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation
HP ALLBASE/BRW Reference Manual
Conditions/Boolean Operations
The HP ALLBASE/BRW Calculation Language can be used to express conditions
in IF THEN ELSE operations or as formulas in selection, relation or
suppress line/lineset conditions. Conditions use comparisons and Boolean
operators, and the results are always true or false.
Comparison Operators
Comparison operators used in condition operations are:
------------------------------------------------------------------------------------------
| |
| Operator Definition |
| |
------------------------------------------------------------------------------------------
| |
| = Equal to |
| |
| <> Not equal to |
| |
| < Less than |
| |
| <= Less than or equal to |
| |
| > Greater than |
| |
| >= Greater than or equal to |
| |
| IN Equal to one of the values in a list of expressions or one of |
| the values of a list parameter |
| |
| MATCHES Matches a pattern or a list of patterns |
| |
| SATISFIES Satisfies the actual condition of the comparison predicate |
| parameter |
| |
------------------------------------------------------------------------------------------
Examples of comparison operations include:
city = "New York"
paid-amount + discount-amount < invoice-amount
country IN ("Europe", "North America", "South America")
color IN ?color-list
For the color IN ?color-list example, an actual color can be specified at
report execution time in place of the ?color-list parameter.
Note that the following example:
product-no SATISFIES ?product-no
allows flexible selection on PRODUCT-NO because the selection criteria
(that is, value and operator) are supplied when the user requests the
report.
String Comparisons
String comparisons have these characteristics:
* When strings of different lengths are compared, the shorter one is
padded with trailing blanks.
Patterns
Patterns have these characteristics:
* They are constants with optional mask characters.
* They are always enclosed in double quote marks.
* They use ? as the mask for one character and @ as the mask for
any number of characters, as shown in these examples:
customer-no MATCHES ("ZJ@E", "@B")
This comparison selects all customer numbers beginning with ZJ and ending
with E, or those ending in B.
city MATCHES ("?????@")
This comparison selects all cities with names of 5 or more characters.
Boolean Operators
Boolean operators allow the combination of single comparisons, as shown
here:
------------------------------------------------------------------------------------------
| |
| Operator Definition |
| |
------------------------------------------------------------------------------------------
| |
| NOT True, if comparison is false |
| |
| AND True, if both comparisons are true |
| |
| OR True, if one or both comparisons are true |
| |
------------------------------------------------------------------------------------------
Examples of Boolean operators include:
product-no SATISFIES ?product-no AND
order-no SATISFIES ?order-no AND
order-date SATISFIES ?order-date
MPE/iX 5.0 Documentation