109
Building CLEM Expressions
Complex Expressions
Express ions can also be lengthy a nd more complex. The following expression returns true if the
value of two fields ($KX-Kohonen and $KY-Kohonen) fall within the specified ranges. N otice that
here the field names are single-quoted because the field names contain special characters.
('$KX-Kohonen' >= -0.2635771036148072 and '$KX-Kohonen' <= 0.3146203637123107
and '$KY-Kohonen' >= -0.18975617885589602 and
'$KY-Kohonen' <= 0.17674794197082522) -> T
Several functions, such as string functio ns, require you to enter several p arameter s using correct
syntax. In the following example, the function subscrs is used to return the first character of a
produce_ID field, indicating whether an item is organic, genetically modified, or c onventional.
The results of an expression are described by -> `result`.
subscrs(1,produce_ID) -> `c`
Similarl y, the following exp r ession is:
stripchar(`3`,`123`) -> `12`
It is important to note that characters are always encapsulated within single backquotes.
Combining Functions in an Expression
Frequently, CLEM expressions consist of a combination of functions. The following function
combines subscr and lowertoupper to return the first character of produce_ID and convert it to
upper case.
lowertoupper(subscr(1,produce_ID)) -> `C`
This same expression can be written in shorth and as:
lowertoupper(produce_ID(1)) -> `C`
Another commonly used combination of function s is:
locchar_back(`n`, (length(web_page)), web_page)
This e xp r ession locates the character `n` within the values of the field web_page reading backward
from the last character of the field value. By including the length function a s well, the expression
dynamically calculates the length o f the current value rather than using a static nu mber, such a s 7,
which will be invalid for values with less than seven characters.
Special Functions
Numerous special functions (preceded with an @ symbol) are available. Commonly used
functions include:
@BLANK('referrer ID') -> T