- Public UDF: Public UDFs can be used by all the users in the repository. Public UDFs can be used in transformations, Workflows, Link conditions and in Command task.
- Private UDF: Private UDF can only be used inside a public UDF.
Follow the below steps to create a
- Login to the Mapping Designer and open any folder. Select the User-Defined Functions sub folder.
- Go to toolbar, click on tools->User defined function->new. This opens a new window for creating the UDF.
- Now enter the UDF name in the Name field. Select the UDF type as public or private. Add the required number of arguments(Name, datatype, prcesision and scale).
- Click on the Launch Editor button. This opens an expression editor window. Here define the functionality of the UDF by using the existing built-in functions, User defined function and Arguments.
- Click on Ok and save the UDF.
Managing User Defined Functions:
Once you created a UDF, you can see the properites, edit and delete the UDF. Right click on the UDF name for managing. The follwing image shows the options avialable for managing the UDF.
- Public UDFs cannot be changed to private UDFs. Where as private UDFs can be changed to Public UDFs.
- You can call a user defined function by using :UDF prefix before the function name. Ex: :UDF.RemoveSpaces(Portname).
- You cannot nest the a UDF within the same UDF.