The **Transformation** step in RiskOS™ lets you manipulate data within a workflow using a set of predefined, **stateless functions**. Transformations do not maintain state; they operate only on the data provided as inputs at the time of execution.

For example, you can use the `CONCAT` function to combine `firstName` and `surName` into a single `fullName` variable. That new variable becomes immediately available to downstream steps, simplifying logic and reducing duplication.

## Placement in a workflow

- A Transformation step can be placed **anywhere** in a workflow, depending on your logic.
- Common patterns include:
  - Right after the **Input** step to normalize incoming data.
  - Before a **Condition** step to prepare data for evaluation.
  - After an **Enrichment** step to parse out specific data.

## Configure a Transformation step

1. Add the Transformation step to your workflow, then click the step to open the side panel.

2. Select a **Function** from the dropdown (see [Available functions](https://help.socure.com/riskos/docs/transformation#available-functions) below).

3. Provide input parameters for the function:
   - **Value**: For static values (e.g., strings, numbers).
   - **Variable**: For dynamic inputs, such as payload fields or outputs from prior steps.
4. Specify the **output field name**.
   - The function’s result is stored in this field.
   - Use it later with `$[output_field_name]`.
   - Example: If you name the output field `fullName`, reference it downstream as `$fullName`.

> 📘
>
> **Note**:
>
> You can customize the Transformation step’s label by editing the text field at the top of the side panel.

## Available functions

> 📘
>
> **Note**:
>
> This catalog lists supported stateless functions. Check release notes regularly to confirm the latest set of functions available in your environment.

### String functions

| Transformation                             | Input                      | Output  | Description                                                                                      |
|--------------------------------------------|----------------------------|---------|--------------------------------------------------------------------------------------------------|
| `STARTSWITH`                              | String + substring         | Boolean | True if a string starts with the substring (ignores leading whitespace).                         |
| `ENDSWITH`                                | String + substring         | Boolean | True if a string ends with the substring (ignores trailing whitespace).                         |
| `LENGTH`                                  | String                     | Numeric | Returns the string length.                                                                       |
| `CONTAINS`                                | String + substring         | Boolean | True if the string contains the substring.                                                       |
| `TO_LOWER_CASE`                           | String                     | String  | Converts to lowercase.                                                                           |
| `CONCAT`                                   | Multiple strings            | String  | Joins strings into one.                                                                          |
| `SPLIT`                                   | String + separator         | Array   | Splits string into an array of substrings.                                                      |
| `FIRST_N`                                 | String + numeric value     | String  | Returns the first n characters.                                                                  |
| `REVERSE`                                 | String                     | String  | Reverses a string.                                                                               |
| `JARO_WINKLER_DISTANCE`                    | Two strings                | Numeric | Calculates similarity using Jaro-Winkler distance. This function does not normalize the input strings. |
| `SIAMESE_JARO_WINKLER_DISTANCE`            | Two strings                | Numeric | Calculates similarity using Jaro-Winkler distance optimized for names; normalizes input, tokenizes, and alphabetically sorts tokens (so "Ryan Reisling" ≈ "Reisling Ryan"). |
| `SUBSTRING`                               | String + start + end positions | String  | Extracts substring between two positions.                                                       |

### Numerical functions

| Transformation  | Input                   | Output  | Description                                                  |
|------------------|------------------------|---------|--------------------------------------------------------------|
| `DIVISION`     | Two numbers            | Numeric | Returns quotient.                                            |
| `MULTIPLICATION` | Two numbers            | Numeric | Returns product.                                            |
| `SUM`         | One or more numbers     | Numeric | Returns total.                                              |
| `MODULUS`     | Two numbers            | Numeric | Returns remainder.                                        |
| `SUBTRACT`    | Two numbers            | Numeric | Returns the difference.                                  |
| `RANDOM_NUMBER` | Min + max values       | Numeric | Returns a random number within range.                     |

### Array functions

| Transformation       | Input                      | Output  | Description                                                              |
|-----------------------|----------------------------|---------|--------------------------------------------------------------------------|
| `IS_IN_ARRAY_ANY`     | String(s) + array          | Boolean | True if any element is in the array.                                   |
| `IS_IN_ARRAY_ALL`     | String(s) + array          | Boolean | True if all elements are in the array.                                 |
| `JOIN`                | Array                       | String  | Joins array elements into a space-separated string.                     |
| `ARRAY_LENGTH`        | Array                       | Numeric | Returns the number of elements.                                       |
| `COUNT_DISTINCT`      | Array                       | Numeric | Returns the number of unique items.                                   |

### Date functions

| Transformation            | Input                               | Output  | Description                                            |
|----------------------------|----------------------------------------|---------|--------------------------------------------------------|
| `DATE_DIFF_IN_DAYS`       | Two dates (ISO) or date + "today" | Numeric | Days between two dates.                              |
| `CALCULATE_AGE`           | Date of birth (ISO)                 | Numeric | Age in years.                                       |
| `TIME_DIFF_IN_SECS`       | Two timestamps (ISO)                 | Numeric | Seconds between two timestamps.                      |

### Special functions

| Transformation                           | Input              | Output | Description                                          |
|-------------------------------------------|--------------------|--------|------------------------------------------------------|
| `GEO_DISTANCE_LAT_LONG`                   | Two lat/long coordinate pairs | Numeric | Distance (in km) between two coordinates.         |
| `EXTRACT_EMAIL_HANDLE`                    | Email address      | String | Returns the part after "@".                        |
| `EXTRACT_EMAIL_USER`                      | Email address      | String | Returns the part before "@".                       |
| `IS_NULL`                                 | Any                 | Boolean| True if the value is null.                          |
| `COPY`                                    | Any                | Any    | Copies input to output.                              |
| `DECLARE_CUSTOM_VARIABLE`                 | Any                 | Any    | Declares a custom variable to use later (e.g., as input to another step).|
| `INSPECT_VALUE`                           | Any                 | Any    | Shows the value and type of a given variable name. Useful for workflow debugging. |

## Best practices

- Place transformations where they add clarity or efficiency — e.g., normalize data early, simplify condition checks, or prep values before decisions.
- Use clear names for output fields so they’re self-explanatory in downstream steps.
- Validate transformation results with test payloads to avoid logic errors.
