Re-use Functions

You'll often get to the Function editor from a specific Workflow step (such as Filter, Transform or Validate). While building out the Function, you might decide that the operation (or part of it) would be useful in other steps or even other Workflows. To do that, you have to make it re-usable first.

Turn on Drag select (or Ctrl+click), highlight all of the required Function components (ensure this returns to a single value to be a valid Function) and click Make re-useable. Give your Function a name, description and other details then Apply to create a custom Function.

Using variables

Variables are useful to simplify complex Functions and make them easier to read. They are especially useful when using the same value multiple times in a Function.

To turn part of your Function into a variable, click on a step then Make variable. Give it a name and some description text. If you add a description, the text will appear as a tooltip when hovering over the variable, wherever it's used in the Function..

Once created, it is possible to select this Variable as an Input value anywhere else in the Function.

As well as readability, variables appear as columns in the Preview grid. This allows you to see the value of the input mid-way through the Function, next to the final result, so you could introduce a variable at each stage of a complex Transformation to ensure the results are correct at each stage.

Testing your Function with parameters

To test that a Function works in different scenarios, you can specify test data for it by clicking Parameters while in edit mode.

A parameter can be a column of values from an existing Dataset/View, or you can define your own comma-separated list of test values. The values you enter will be treated as alphanumeric unless a datatype is specified:

  • Numeric value - prefix with {n}, e.g.: {n}1234
  • Boolean value - prefix with {b}, e.g.: {b}true
  • Date value - prefix with {d}, e.g.: {d}1990-01-01 or {d:yyyy-MM-dd}1990-02-03
  • Use double quotes " " if a test value contains a comma, e.g.: AB-123,{n}23.53,"Test, value"

Each parameter will appear as a column in the Preview grid, making it easy to check whether the Function is returning the expected result.