User-defined functions are reusable functions that you can use in expressions. Create user-defined functions to build complex expressions using the
Informatica Intelligent Cloud Services
transformation language. User-defined functions use the same syntax and can use the same transformation language components as transformation and field expressions.
You can include a user-defined function in a transformation expression in a mapping or mapplet, in a field expression in a
mapping
task, or in another user-defined function. To use a user-defined function in an expression, you select the user-defined function in the expression editor and enter the required arguments.
You can't use a user-defined function in an expression in a
synchronization
task.
You can include user-defined functions in the following transformations in advanced mode:
Aggregator
Expression
You can't use user-defined functions in expressions in mappings in SQL ELT mode.
Example
You want to remove leading and trailing spaces from a text string such as a name or address. You create a user-defined function called RemoveSpaces that takes a text string as an argument and performs the LTRIM and RTRIM functions. When you configure the user-defined function, you enter the following expression:
LTrim( RTrim(TextString) )
After you create the function, you use it in an Expression transformation to remove leading and trailing spaces from the incoming field, LAST_NAME. The expression field contains the following expression:
:UDF.RemoveSpaces(LAST_NAME)
In the expression, the user-defined function name is prefaced with :UDF. The incoming field LAST_NAME is passed to the function as the argument.