Mapping string functions: BasicStringFuncMapper element
The BasicStringFuncMapper element is used for customizing the mappings of the functions listed in Table 10‑7. The table also shows the default template for each function.
Table 10‑7 Default templates for mapping string functions
String function
Operand data types
Default template
CHAR_LENGTH
<VARCHAR>, <INTEGER>
{FN LENGTH ($P0)}
UPPER
<VARCHAR>
{FN UCASE ($P0)}
LOWER
<VARCHAR>
{FN LCASE ($P0)}
LTRIM
<VARCHAR>
{FN LTRIM ($P0)}
RTRIM
<VARCHAR>
{FN RTRIM ($P0)}
CONCAT
<VARCHAR>, <VARCHAR>
{FN CONCAT ($P0, $P1)}
Example: Mapping the CHAR_LENGTH function
The Actuate SQL CHAR_LENGTH function returns the length of a string including trailing spaces. The corresponding database function, however, ignores trailing spaces. To resolve this discrepancy, the following mapping appends an underscore (_) to the string, applies the database function LEN, and subtracts one:
<BasicStringFuncMapper>
<FunctionMappings>
<FunctionMapping FunctionName="CHAR_LENGTH">
LEN ($P0 + '_') - 1
</FunctionMapping>
</FunctionMappings>
</BasicStringFuncMapper>