Script Command: if/then


(Contents)(Previous)(Next)

Format:

if condition then goto LABEL;

The if/then command lets you branch on a condition. Currently, PC Access evaluates conditions consisting of string comparisons. You can compare a variable against another variable or against a string constant. PC Access compares variables as strings, character by character, case-sensitively, using the ASCII collating sequence. The available conditional operators are:

Operator Meaning
== equality
!= inequality
>= greater than or equal to
<= less than or equal to
> greater than
< less than
Note that in the ASCII collating sequence, uppercase characters precede (are less than) lowercase characters. Therefore while "dog" is greater than "cat", "Dog" is less than "cat". String comparisons can be misleading if both strings consist of digits but have different numbers of characters. For example, the string "10" is less than "9" even though the number 10 is greater than the number 9. This is because a string comparison works character-by-character. Comparing the first characters of the strings "10" and "9" shows that "1" is less than "9". Therefore the entire string beginning with "1" is less than the string beginning with "9" regardless of what digits follow.

Example:

label LOGIN;

if @CONNECT_TYPE == "RLOGIN" then goto MLS_LOGIN;


(Contents)(Previous)(Next)