Boolean Expression

Boolean expressions - or conditions - guide the logic of ESTA's dialog.They are used as part of if-statements in section declarations and rules fields of parameters. Boolean expressions are either true, false or unknown. They consist of:

Comparisons between number expressions or between names and strings may be written using one of the relational operators:

< smaller than

<= smaller than or equal to

= equal to

> greater than

>= greater than or equal to

<> different from

When strings are compared, the characters of the two strings are compared one by one by replacing the characters by their ASCII values. Thus, the comparison 'A' < 'B' is true because 65 (the ASCII value of 'A') is less than 66 (the ASCII value of 'B'). The comparison goes from left to right until a pair of letters gives a result.

Compound boolean expressions are formed using the logical operators: and, or and not. Not has the highest priority of the logical operators - actually even higher than the mathematical operators. On the other hand, and and or have lower priority than the mathematical operators. As in number expressions parantheses may be used to implement any order of evaluation.

The syntax for a boolean expression is:

<boolean-expression> ::=

<number-expression> <relational-op> <number-expression> |

<text-expression> <relational-op> <text-expression> |

<boolean-expression> and <boolean-expression> |

<boolean-expression> or <boolean-expression> |

not [(] <boolean-expression> [)] |

true |

false |

unknown |

<parameter-name> |

known(<parameter-name>)

<relational-op> ::= < | > | <= | >= | = | <>

The function known returns true if the parameter has a value, otherwise it returns false.

Examples

number_of_days_required / 7 < weeks_required

favourite_colour = 'red'

not pays_highest_rate_tax

has_retired or is_unwell

date_of_birth < 1960 and owns_a_car

x and not y or z /* (x and not(Y)) or z) */