Custom Functions
Last updated
Last updated
In Tabula.io, users can create and utilize custom functions to enhance their data manipulation capabilities. While the platform lacks a direct user interface for this feature, custom functions can be easily implemented through a JSON configuration.
Custom functions are defined in a specific JSON structure. Use the following template for a custom function and save it as YourFunctionName.json file:
Function Name:
name
: Enter the name of your custom function.
Function Parameters (Arguments):
valueParameters
: List the parameters your function will use.
name
: Specify the name of each parameter.
typeSet
: Define the type of each parameter. Possible types include String, Integer, Double, Date, DateTime, Time, Object, Array, and AnyType.
argumentDescription
: Describe each parameter to explain its purpose and usage.
Return Type:
returnType
: Indicate the type of value your function returns. Options include String, Integer, Double, Date, DateTime, Time, Object, Array, AnyType.
Function Description:
description
: Write a brief description of what your function does and its intended use.
Function Body (Expression):
body
: Input the expression that defines your function's logic. It's recommended first to test the expression using the New Column node for validation, then copy it to the file. Remember to add additional escape characters (\
) before quotes ("
) and backslashes (\
) in the expression.
For instance, an email validation expression in the New Column node might be:
In the JSON file, it should be formatted as:
Save the File: Store the JSON file in the appropriate directory:
For Mac OS: /Users/%username%/Library/Application Support/tabula/latest/udfs
For Windows: C:\Users\%username%\AppData\Roaming\tabula\latest\udfs
Replace %username%
with your actual username.
After saving the file, restart the Tabula application for the custom function to be recognized and available.
Thorough Testing: Before implementing your custom function in critical data flows, test it extensively to ensure it behaves as expected.
Clear Naming Conventions: Use clear and descriptive names for your functions and parameters for easy understanding and maintenance.
Comprehensive Descriptions: Provide detailed descriptions for your functions, outlining their purpose and how they work, to assist other users.