"Reorder columns" node

The Reorder columns node lets you change the order of the columns in a file.

By maintaining a standardized and consistent column order in the files, you ensure that the data can be easily exported into the inventory system without manual adjustments or errors.

This node can be used only with CSV files.

Node configuration


  1. To use this node in a data transformation rule, go to Automation Hub > Data Transformation > New transformation.
  2. Click Add input.
  3. Select the file you want to transform and confirm by clicking Apply.
    You can find more information about adding input in the "Data Input" node article.
  4. Add the Reorder columns node.
  5. Open its settings by clicking the node.
  6. Click Add rule.
  7. From the Include dropdown list, define if you want to create a rule which includes (the these option) the columns or excludes (the all except these option) the columns which meet the conditions defined in the rules.
    The Include option
    The Include option
  8. Select columns to include/exclude (according to the Include option from the step before) from reordering in one of the following ways:

    • Select column - from the dropdown list, you can select the columns to be included or excluded from the transformation.
    • Add condition - you can create a dynamic condition which columns must meet to be reordered; for this purpose, you can use logical operators such as contain, starts with, ends with, and so on.

    You can't combine dynamic conditions with the Include all except these option.

    For further instructions, select one of the tabs below, depending on the option you have chosen in step 3.

    1. From the dropdown list, select the first column that will be moved to a different position.
    2. To change the position of more columns, click Adding new icon icon.
    Define condition option
    Define condition option
    1. Select one of the following logical operators to define the conditions which the column name must meet:
      • Ends with - The column name must end with the phrase you enter.
      • Starts with - The column name must start with the phrase you enter.
      • Contain - The column name must contain the phrase you enter.
      • Not contain - The column name can't contain the phrase you enter.
      • Regex - The column name must match the regular expression you enter.
  9. From the Move columns dropdown list, select one of the options below.
    If more than one column is selected/meets the rule, the columns will be in an order of adding it to the conditions, see example of use.

    • To the beginning - Selected columns/Columns which meet the conditions will be moved to the beginning of the file (far left).

      The original position of the column in an example file
      The original position of the column in an example file
      The column reordered according to the To the beginning option
      The column reordered according to the To the beginning option
    • To the end - Selected columns/Columns which meet the conditions will be moved to the end of the file (far right).
      The original position of the column in an example file
      The original position of the column in an example file
      The column reordered according to the To the beginning option
      The column reordered according to the To the end option
    • Before column - Selected columns/Columns which meet the conditions will be placed immediately before (to the left) the selected column.
      The original position of the column in an example file
      The original position of the column in an example file
      The column reordered according to the Before column option
      The column changes its place before the email column
    • After column - Selected columns/Columns which meet the conditions will be placed immediately after (to the right) the selected column.
      The original position of the column in an example file
      The original position of the column in an example file
      The column reordered according to the After column option
      The column reordered according to the After column option
    • To position - Selected columns/Columns which meet the conditions will be moved according to the position you indicate by a number.
      The original position of the column in an example file
      The original position of the column in an example file
      When you set the position to 0
      The column reordered according to the To position option
      The column reordered according to the To position option
      When you set the position to 1
      The column reordered according to the To position option
      The column reordered according to the To position option
      When you set the position to 2
      The column reordered according to the To position option
      The column reordered according to the To position option
  10. To add more rules, click Add rule, and repeat steps 2-4.
    Rules are joined with the AND logical operator.
  11. Confirm by clicking Apply.

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 Handle incomplete data 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 the null value.
  • Insert empty string if error occurred - Wrong value is removed and the cell remains empty.

Example of use

In the following example, we will organize columns in a file so email, name, surname columns will be at the beginning of the file. The initial state of the file is as follows:

marketing_agreement,country,surname,name,email
false,USA,Doe,John,john.doe@example.com
true,USA,Smith,John,john.smith@example.com
false,England,Williams,Jane,j.williams@example.com
true,Wales,Brown,Rachel,rachel.brown@example.com
  1. As the first node, add Data Input.
  2. In the configuration of the node, upload a file on which you want to perform data transformation.
  3. As the next node, add Reorder columns.
  4. In the configuration of the node:
    1. Click Add rule.
    2. Leave the Include option at default (these).
    3. Click Select columns. From the dropdown list, select the columns in the preferred order, in this case it will be: email, name, surname.
    Selected columns
    Selected columns
    1. Set Move columns option to To the beginning.
      Result:
      Output of the transformation
      Output of the transformation
    2. Confirm the settings by clicking Apply.

Canonical URL: https://hub.synerise.com/docs/automation/data-transformation-and-imports/transformations-and-data-operators/reorder-columns