Example: Prefixing a number or string value

You can use a value descriptor to clarify what a number or string value represents.

If you want to define a value Year as a number, you cannot associate the predefined IlrValueNumberDescriptor with this value because that descriptor is already used for representing numbers, and you cannot have more than one value descriptor defining the same text representation. In this case, if you write the following statement in the definitions part of an action rule, you cannot tell whether the variable y is a Date or a Number:

set y to 2005; 

To make it clear what the number represents, you can define a value descriptor to represent the Number value as another value, such as Year.

To make sure that the text representation is unique, you must prefix the value label in the vocabulary with the name of the represented value. For example, for the value Year, the value label would be the year {Number}. Now when you set the following definition, the variable y is interpreted as a Date:

set y to the year 2005; 

You can use a value descriptor to clarify String values in the same way, by prefixing the value label with the name of the value you want to represent.

If you want to use a predefined value descriptor to define your own values, for example to represent a full date as another value, you use the fully qualified name of the corresponding System BOM class, {ilog.rules.brl.FullDate}, in the value label.