Transform Data from Vendor Feeds


Duoplane imports vendor feeds for several types of data, most commonly inventory updates and shipment confirmations. Occasionally, data from the vendor needs to be transformed before it can be imported into Duoplane. Vendor feed transformations allow you to dynamically change vendor data before they are imported into Duoplane.

How to set up transformations

The transformation is accomplished using a Liquid template. That template objects (variable names or placeholders) are described below.

To create a transformation template for a specific field:

  1. Navigate to the feed configuration page. (For example, where you set up the inventory feed for a specific vendor.)
  2. Scroll to the "File column mapping" section
  3. Click "Transform imported data"
  4. Enter the transformation code in the "Transformation template" are for that column.



Liquid template placeholders

These are the Liquid objects that are available to you when creating transformation templates.

original_value The value of this column directly from the vendor feed.

The contents of the entire row represented as a hash, or a set of key-value pairs. The key is the column heading, and the value is the value of that column for this row.

For example, if the original file has the columns SKU and Quantity Available, you could access those values in your template using raw_data['SKU'] and raw_data['Quantity Available'].



Below are some common examples of data transformations. Please see the Liquid documentation for full detail on how to use templates.


Modify an inventory value

This takes the original value from the feed and subtracts 5:

{{ original_value | minus: 5 }}


Replace a description with a value

This takes text descriptions and replaces them with integer values:

{% if original_value == "In stock" %}10{% elsif original_value == "Low stock" %}5{% else %}0{% endif %}


Static value

This replaces every value in a certain column with the number 100:



Remove an extra character

This removes the "#" character from the imported data:

{{ original_value | replace: "#", "" }}


Remove the whole value if it contains a certain substring

This sets the imported field to a blank value if it contains "E+". This is useful for removing tracking numbers that have been converted to scientific notation by Excel:

{% unless original_value contains "E+" %}{{ original_value }}{% endif %}


Zero-pad a number

This prepends zeros to a number so that it is always 12 digits. This is useful for normalizing UPC codes that have been converted to numbers by Excel:

{{ original_value | floor | prepend: '000000000000' | slice: -12, 12 }}


Sum two columns

This adds the values in the columns "Qty_DC1" and "Qty_DC2":

{{ raw_data['Qty_DC1'] | plus: raw_data['Qty_DC2'] }}

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.