Range Compared with a Relational Operator for the Add Attribute Command

This form offers greater flexibility in defining the range of possible values for the add attribute command.

range RELATIONAL_OPERATOR VALUE

A relational operator compares the user’s value to a set of possible values. Choose from these relational operators:

Operator Operator Name Function
= is equal to The user value must equal this value or another specified valid value (given in another Range clause). When comparing user-supplied character values to the range value, uppercase and lowercase letters are equivalent.
!= is not equal to The user-supplied value must not match the value given in this clause. If it matches, the user is notified that the value is invalid. When comparing user-supplied character values to the range value, uppercase and lowercase letters are equivalent.
< is less than The user value must be less than the given range value. If the user value is equal to or greater than the range value, it is not allowed.
<= is less than or equal to The user value must be less than or equal to the given range value. If the user value is greater than the range value, it is not allowed.
> is greater than The user value must be greater than the given range value. If the user value is equal to or less than the range value, it is not allowed.
>= is greater than or equal to The user value must be greater than or equal to the given range value. If the user value is less than the range value, it is not allowed.

Depending on the relational operator you use, you can define a range set that is very large, or a set that contains a single value. When you use a relational operator, the value provided by the user is compared with the range defining value. If the comparison is true, the value is allowed and is assigned to the attribute. If the comparison is not true, the value is considered invalid and is not allowed.

For example, assume you want to restrict the user to entering only positive numbers. In this case, you could define the range using either of the following clauses:

range > -1
Or:
range >= 0

If the user enters a negative number (such as -1), these commands are false (-1 is not greater than -1 and is not greater than or equal to zero). Therefore the value is invalid.

You might have an attribute with a few commonly entered values but that can actually be any value. To provide the user with the ability to select the commonly entered values from a menu, but also allow entry of any value, you would:

  • Add the ranges of Equal values for the common values.
  • Add a range of Not Equal to xxxxx.

This syntax allows any value (except xxxxx) and provides a list from which to choose the common values.

When defining ranges for character strings, remember that you can also perform comparisons on them. Using the ASCII values for the characters, you can determine whether a character string has a higher or lower value than another character string. For example “Boy” is less than “boy” because uppercase letters are less than lowercase letters and “5boys” is less than “Boy” because numbers are less than uppercase letters. For more information on ASCII values, refer to an ASCII table.

If the attribute value has a second part that was to start with the letters REV, you can use a pattern in the Range clause. For more information, see Range Compared with a Pattern (Special Character String) for the Add Attribute Command.