The following operators are available: concat, subtext, indexof.
Concatenation of strings
XML tag: |
Concat |
|
Operands: |
exactly one set of values (strings) |
|
Synopsis: |
<concat> <Value set 1> </concat> |
|
Operands: |
TEXT |
|
Result: |
Value (string) |
|
Result type: |
TEXT |
|
Calculation (PPM3/PPM4) |
Result |
Result of the concatenation of all strings contained in the set of values. NULL if operand is an empty set |
Error |
If at least one value is of an invalid data type |
|
Example: |
- |
Extraction of substrings
XML tag: |
Subtext |
|
Operands: |
exactly one value (string) |
|
Synopsis: |
<subtext beginindex="..." [endindex=" "]> <Value> </subtext> Example <subtext> <Value> <beginindex>...</beginindex> <endindex>...</endindex> </subtext> You should only use one of the two variations outlined (index specified either as an XML attribute or an XML element). |
|
Operands: |
TEXT |
|
Result: |
Value (extracted string) |
|
Result type: |
TEXT |
|
Description: |
Extracts a substring from a string by specifying positive indices (from the start of the string) or negative indices (from the end of the string). |
|
Calculation (PPM3) |
Result |
Returns a substring of the string transferred by the operand. |
Error |
If operand is NULL or of an invalid data type |
|
Calculation (PPM4) |
Result |
Returns a substring of the string transferred by the operand. |
Error |
If data type is invalid (not TEXT) |
|
Example: |
<subtext beginindex="-3" endindex="-1"> Example <subtext> Assuming the value ABCDE for the AT_XYZ attribute, the substring CD is extracted. |
Identify position of sub-text in another text
XML tag |
<indexof> |
|||
Description |
Returns the index in a text (operand 1), where the first occurrence of a sub-text (operand 2) is located, starting at a specified index (operand 3). |
|||
Operands (Position/ Data type) |
1 / TEXT 2 / TEXT [ 3 / LONG ], optional, default value is 0 |
|||
Calculation |
from PPM 9.0 |
|||
Calculation (PPM4) |
Result |
-1, if at least 1 operand equals NULL, or if the substring is not found Index of the first occurrence of the text determined by operand 2 in the text determined by operand 1 starting from the index specified in operand 3 (like Java String.indexOf(String, int)). |
||
Data type |
LONG |
|||
Exception |
If at least 1 operand has an invalid data type or operand 3 < 0 |
|||
|
||||
|
||||
|
||||
Example |
<subtext mode="PPM4"> <filteredattribute name="AT_TEXT" … /> <beginindex> <indexof> <filteredattribute name="AT_TEXT" … /> <constant> <dataitem> XYZ <datatypename="TEXT">Text</datatype> </dataitem> </constant> </beginindex> </subtext> |
|||
|
In the example, the operators indexof and subtext are used together. indexof determines the position of the text XYZ in the attribute value of the attribute AT_TEXT. Then, the subtext operator identifies the substring from this position. If the AT_TEXT attribute has the value ABCDEXYZAC, the above calculation rule would return the value XYZAC. |