"Edit values" node
This node lets you apply rules which define how the values in the file are modified. The scope of editing covers:
- adding a suffix/prefix to the values
- replacing the value with:
- a fixed value (selected values are replaced with a defined string)
- dynamic value (usage of Jinja that allows you to perform advanced operations on editing values, expcept for custom tags, for example, tags which refer to the customer’s attributes, aggregates, expressions, and so on)
- values from other column,
- UUID (UUID v4)
- current date
You can select the columns whose values are included or excluded from editing. Additionally, you can apply a filter to the rule, so that only matching values are modified.
Node configuration
- Double-click the Edit value node.
- Click Add rule.
- Select the columns which you want to include or exclude in the rule.
- To apply a filter to the rule, next to the Include header, click > Add value filter.
- Select one of three options:
- Add prefix - Adds a string to the beginning of every value in a column.
- Add suffix - Adds a string to the end of every value in a column.
- Replace
- Static value - Searches for values that match the conditions (if the filter is applied) and replaces these values with those you indicate
- Dynamic value - Searches for values that match conditions (if the filter is applied) and replaces these values according to the logic expressed by an insert (Jinja). The use of custom Jinja tags (for example, referring to customer attributes, aggregates, expressions, and so on) is not possible.
- Column - Searches for values that match the conditions and replaces these values with the values from a column you select.
- UUID - fills the column with a randomly generated UUID v4 (unique for each row).
- Current date - fills the column with the current date (the date and time are generated on an ongoing basis during the transformation).
- To add more rules, click Add rule and repeat steps from 2 to 5.
- You can check the preview of the file after changes in the Output data tab.
- To define what happens if rows contain errors, select one of the options available in the Error handling section.
- Confirm the settings by clicking Apply.
Current date option
Using the Current date option, you can enrich your data with a dynamically injected date and time which can be used, for example, to build an event salt. To define a rule with Current date:
- Select a timezone.
- Select one of the available formats:
- ISO (for example 2022-10-05T05:55:16.786596Z)
- Timestamp (for example 1664949342323)
- MMM d, YYYY (for example Oct 5, 2022)
- MMM d, YYYY, HH:mm:ss (for example Oct 5, 2022, 05:57:14)
- YYYY-MM-dd HH:mm (for example 2022-10-05 05:57)
- Custom - you can create your own date and time format.
Custom date format
You can use the following elements to build a custom format. The example values use October 05, 2022 as the date.
- MMM - name of month (Oct)
- MM - number of month (10)
- DD - day of year (278)
- dd - day of month (05)
- YYYY - year (2022)
- YY - year (22)
Handle errors
You can define what to do with failed values (for example, as a result of Jinja rendering or in other cases) in cells where data type modification failed. In the Error handling section, select one of the following options:
- Skip row if error occurred - It omits the row when an exception occurs.
- Skip if result is null or empty string - It omits rows with empty strings and
null
(which may be the result of rendering Jinja) - Stop further transformation - The transformation stops at the row with an error. The data before the line that caused the error is transformed (and imported if the transformation rule is used in the Data Transformation node).
- Insert null if error occurred - Wrong values are replaced with
null
. If you use such a transformation for the import of profiles, the existing value of an attribute is cleared and replaced with thenull
value. - Insert empty string if error occurred - Wrong value is removed and the cell remains empty.
Example of use
In example transformation +48
is removed from all values in a given column.
- Start the transformation with the Data Input node.
- Click the node.
- Upload a sample file used to configure the transformation for later use and preview its results.
- Confirm the configuration of the node by clicking Apply.
- Add the Edit Values node.
- Double-click the node.
- Select the column to be transformed.
- Replace all values that begin with
+48
in the selected column with an empty value. - Confirm the changes by clicking Apply.
- Add the Data Output node.
- In the preview of the Data Output node, all values in the column that began with
+48
are transformed and the+48
value was removed.