SML has many built-in functions. The functions can split into three distinct groups:
Built-in functions are accessed via the Edit | Insert Built-in Function.. menu
item.
This launches the SML dialog.
The function groups are as follows:
| General Functions | Advanced Functions | Specialist Functions |
| Aggregate | Java | Transaction Handling |
| Cascade | Database Specific | |
| Date and Time | SML Procedures | |
| Data Quality | XML | |
| Error Handling | Units of Measure (UoM) | |
| Error Recording | ||
| Internationalisation | ||
| Logging and Testing | ||
| Maths | ||
| Other | ||
| Pseudo-attributes | ||
| String |
For a complete listing of all built-in functions on one page, go here.
Nesting Functions
SML allows nesting of functions to any level as long as each function provides a return value that is a valid input argument to the next level. All functions that accept an argument will accept the result of an expression in place of a variable or attribute name.
For example, the description of the
STARTSWITH() function includes the line:
IF STARTSWITH (TRIM ($Content),
'The')
This shows the output of the
TRIM()function being used as one of the arguments of the
STARTSWITH() function.
Similarly, it might be necessary to check for the presence (or absence) of a particular word within one or other of two strings; this can be achieved in a single line by nesting:
If sPos contains -1 then ‘word’ does not
exist in either string.
Although nesting to any depth is allowed, it is recommended that in order to maintain readability of the code, functions are not nested more than two or three levels deep in any one statement, . There are no performance gains to be made by trying to reduce the number of SML statements in a Transform by making each statement more complex; TM splits complex statements into simpler ones as part of the process of generating Java from the SML source.