Trifacta's Wrangler interface provides a wide range of functions to transform your data. However, you may need to define custom functions that are not provided out-of-the-box to meet your specific use cases. To support these specific use cases, Trifacta allows you to create custom user-defined functions.
A user-defined function (UDF) is an externally created function that can be imported into the product for use in your recipe.
Your enterprise has a specific method for calculating asset deprecation, which must be applied consistently.
You use specialized statistical calculations for managing risk.
Your industry has commonly used metrics that are not available in the Trifacta application.
Enabling the feature
As a part of v9.1 release, this feature is enabled by default in all Dataprep workspaces and labeled as a Beta feature.
Execution supported for Trifacta Photon and Dataflow jobs
From the Transformer View's toolbar, select the f(x) menu option and choose Create UDF
From the Library, choose User Defined Functions tab, and click the Create UDF button.
2. In the new creation modal:
Name- The name of your function must be unique within the workspace. Avoid using names that correspond to keywords in Wrangle.
Description- Enter a text description for your function.
In the next window-
Paste in the script for your user-defined function.
Click Validate. Fix any errors.
To create the UDF, click Create.
The UDF is now available for use by all users of the workspace.
Search and Use UDFs in Recipes
In the Transform Builder:
You can search for your UDF by name or by entering
In a Formula field, you can reference the function by name or by entering
In Transformer, from the f(x) top menu icon, select Insert UDF and choose a UDF from the search panel to add to your recipe.