Articles in this section

Build a transformation with Rules 2.0

Rules 2.0 lets you build the output record of an export or lookup field by field, without writing code. You choose an output structure, add output fields, point each one at input data with JSONPath, and preview the result against sample records. This article walks you through building a Rules 2.0 transformation from start to finish, including using Celigo Ora to fill in fields automatically. It's for builders who want to reshape records before they reach the next step in a flow.

Prerequisites:

  • Open the Define transformation editor on an export or lookup step. For steps, see Add a transformation to a flow step.
  • Confirm the Input pane shows a sample record. If the sample is out of date, select Refresh input fields.
  • Review the concepts in Transformation 2.0 overview if you're new to JSON structure and input context.

Rules 2.0 isn't available for import-result transformations, which use Rules 1.0 or JavaScript.

Set the structure and input context

  1. At the top of the editor, select Rules 2.0.
  2. Select JSON structure, and then select one of the following:
    • Modify input record { } to keep the full input record and change only the fields you add.
    • record { } to build a new record that contains only the fields you add.
    • rows [ ] to produce row-based output, such as rows for a CSV file.
  3. Select Input context, and then select record or envelope. Choose envelope to read runtime data such as headers or file metadata; record fields then start with $.record.. For every envelope object, see Transformation 2.0 input context reference.

Add output fields

Each row in the editor maps one output field to its input source.

  1. In the Output column, enter the output field name.
  2. Select the data type selector (T ▾) in the Output column, and then select the output data type.
  3. In the Input column, select an input field from the list, or enter a JSONPath expression such as $.customer.email. To build an array from several input fields, enter comma-separated paths, such as $.owner_name,$.owner_phone.
  4. To add another row, select Add at the end of a row.
  5. For an Object or Object array field, expand the row and add child fields the same way.

To have Celigo Ora generate the output fields for you, select Actions elipses-button.png on the toolbar, and then select Auto-populate output fields.

Configure field settings

Standard fields copy the input value as-is. For any other behavior, change the field's settings.

  1. Select Settings between the output and input fields.
  2. In Field transformation type, select Standard, Hard-coded, Lookup, or Handlebars expression.
  3. Complete the settings for that type, and choose an Action to take if input field has no value.
  4. Select Confirm.

The symbol before Settings shows each field's transformation type. For every setting, see Transformation 2.0 field settings.

Fill in fields with Celigo Ora

Auto-transform output fields uses Celigo Ora to choose input values for output fields that have no input field.

  1. Select one or more output fields. Selecting a parent field also selects all its child fields.
  2. Select Actions elipses-button.png on the toolbar, and then select Auto-transform output fields.
  3. Review the input values Celigo Ora adds, and adjust any that are wrong.

Auto-transform doesn't overwrite input values you entered, and it's available only after you add an output field. While it runs, settings that change the output structure are unavailable.

Preview and save

With Rules 2.0 selected, preview and save the transformation. For the steps, see Preview and save.

Toolbar reference

Control What it does
Expand all and Collapse all Shows all child fields, or only top-level fields.
JSON structure Sets the output structure: Modify input record { }, record { }, or rows [ ].
Input context Sets the root of the input data: record or envelope.
Refresh input fields Reloads the sample input so recent changes to the step's data appear in the field list.
Search Finds and highlights output fields by name. Adding a row closes search.
Actions elipses-button.png > Auto-populate output fields Uses Celigo Ora to generate the output fields.
Actions elipses-button.png > Auto-transform output fields Uses Celigo Ora to fill input values for selected output fields.
Actions elipses-button.png > Remove all rules Deletes every rule so you can start over. To remove the transformation, see Remove a transformation.