Table of Contents

Search

  1. Preface
  2. Components
  3. API collections
  4. Business services
  5. File listeners
  6. Fixed-width file formats
  7. Hierarchical mappers
  8. Hierarchical schemas
  9. Industry data service customizer
  10. Intelligent structure models
  11. Refining intelligent structure models
  12. Mapplets
  13. Saved queries
  14. Shared sequences
  15. User-defined functions

Components

Components

Parameterizing user-defined functions

Parameterizing user-defined functions

You can use an in-out parameter that is configured as an expression variable to fully or partially parameterize a user-defined function in an expression.
To parameterize a user-defined function, create a string in-out parameter and enable
Is expression variable
. To fully parameterize the user-defined function, use the parameter in place of the entire user-defined function. To partially parameterize the user-defined function, use the in-out parameter in place of the user-defined function arguments. At run time, resolve the parameter in the mapping task or parameter file.
For more information about in-out parameters, see
Mappings
.

Full parameterization

Use full parameterization when you want to parameterize the user-defined function in an expression. When you use an in-out parameter in place of a user-defined function, parameter names are case sensitive. When you resolve the parameter, include the :UDF prefix.
For example, you have the in-out parameter $$UDFparameter and you use it to fully parameterize a user-defined function. In the parameter file, you resolve the parameter with the following function:
$$UDFparameter=:UDF.RemoveSpaces(names)

Partial parameterization

Use partial parameterization when you want to parameterize the field name in the argument, or when you want to parameterize a nested user-defined function. When you parameterize a nested user-defined function, the parameter in the function argument must be in capital letters. You can nest one user-defined function.
For example, you create the in-out parameter $$UDF and configure it as an expression variable. In the expression, you configure the following function:
:UDF.RemoveSpaces($$UDF)
In the parameter file, you resolve the parameter with the following function:
$$UDF=:UDF.Replace_Chars_special(Name)

Full and partial parameterization

You can use both full and partial parameterization within the same function. Use both full and partial parameterization when you want to parameterize the user-defined function and the function arguments.
For example, you have the in-out parameter $$UDF and use it in an expression to fully parameterize a user-defined function. In the parameter file, you resolve the parameter with the following values:
$$UDF=:UDF.Replace_Chars_special($$Field) $$Field=Name
When you want to pass either the CurrentTaskName, CurrentRunId, or SESSSTARTTIME system variable as an argument in a fully parameterized user-defined function, you must pass the system variable through another in-out parameter.
For example, you want use CurrentTaskName in a parameterized user-defined function. You use the in-out parameter $$UDF to fully parameterize the function. In the parameter file, you resolve the parameter with the following values:
$$UDF=:UDF.udf_InitcapLtrim($$tasknameparam) $$tasknameparam='$CurrentTaskName'

0 COMMENTS

We’d like to hear from you!