user manual

109
Building CLEM Expressions
Complex Expressions
Express ions can also be lengthy and more complex. The following expression returns true if the
value of two elds ($KX-Kohonen and $KY-Kohonen) fall within the specied ranges. Notice that
here the eld names are single- quoted bec ause the eld names contain s pe cial char acters.
('$KX-Kohonen' >= -0.2635771036148072 and '$KX-Kohonen' <= 0.3146203637123107
and '$KY-Kohonen' >= -0.18975617885589602 and
'$KY-Kohonen' <= 0.17674794197082522) -> T
Several function s, such as string functions, requ ire you to enter several param eters using correct
syntax. In the following example, the function subscrs is used to retu r n the rst character of a
produce_ID eld, indicating whether an item is organic, genetic ally modied, or conventional.
The r esults of an expression are described by -> `result`.
subscrs(1,produce_ID) -> `c`
Similarl y, the following expres sion is:
stripchar(`3`,`123`) -> `12`
It is importa nt to note that characters are always encapsulated within s ingle backquotes.
Combining Functions in an Expression
Frequently, CLEM expressions consi st of a combination of functions. The following fun ction
combines subscr and lowertoupper to return the rst character of produce_ID and co nvert it to
upper case.
lowertoupper(subscr(1,produce_ID)) -> `C`
This same expression can be writte n in shorthand as:
lowertoupper(produce_ID(1)) -> `C`
Another commonly used combina tion of functions is:
locchar_back(`n`, (length(web_page)), web_page)
This expression locate s the character `n` withi n the values of the eld web_page reading backward
from the last character of the eld value. By includ ing the length f unction as well, the expression
dynamically calculates the length of the current value rather than using a static num ber, such a s 7,
which will be inva lid 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