In this use case, we will focus on the process of importing and transforming product data from an .XML file using data transformation. This method of data transformation is beneficial as it eliminates the need for the data to be in a predetermined, structured format.
In this use case, we will make the following modifications to the file:
- Add 2 new columns:
- discounted: this column will contain the
truevalue for all products which have a value (price) assigned in theg:sale_pricecolumn. - percentage_discount: this column contains the percentage value of the discount based on
g:priceandg:sale_pricecolumns.
- discounted: this column will contain the
- Edit Values:
Replace the value of
g:availabilitycolumn from1/0toin stock/out of stock.
Input data in use case
In this use case, we use two files:
- the complete
.XMLfile in the Google Merchant Format which contains the full set of products. The file contains the following attributes:g:id,g:title,g:description,g:image_link,g:price,g:sale_price,g:availability. - the sample of the product data in the
.XMLformat. To reproduce this scenario in your workspace, create a catalog and prepare the files.
NOTE: If your product data is complete, you can skip transforming data. But if you need to modify the file with product data before an import to Synerise, you can modify the data in Automation Hub > Transformations. To do so, create a sample of your product data and include all attributes you want to modify. If you miss the attributes in the sample file, but import the actual product data with them, the data will be imported as delivered in the actual file.
Example XML file
```xml Your Store Name https://www.yourstore.com Your Store with clothes 1 Shirt white cotton shirt with a round neck https://www.yourstore.com/product-1 https://www.yourstore.com/product-1-image.jpg 19.99 10.99 1 2 Jeans blue cotton jeans https://www.yourstore.com/product-2 https://www.yourstore.com/product-2-image.jpg 29.99 20.99 0 ```
Process
In this use case, you will go through the following steps:
- Create a transformation to transform the data in the sample file.
- Create a workflow to import the .
XMLfile to Synerise.
Create a transformation
In this part of the process, you define the rules of modifying data before sending it to the Synerise based on the sample file. Each of the following sub-steps describes the individual changes performed on the file. We will add following rules:
- Add 2 new columns:
- discounted: this column will contain the
truevalue for all products which have a value (price) assigned in theg:sale_pricecolumn. - percentage_discount: this column contains the percentage value of the discount based on
g:priceandg:sale_pricecolumns.
- discounted: this column will contain the
- Edit Values:
Replace the value of
g:availabilitycolumn from “1/0“ to “in stock/out of stock“
- Go to
Automation Hub > Transformations > New transformation.
- Enter the name of the transformation.
- Click Upload a new file or drag one here.
Before you proceed with selecting sample data and defining transformation rules, optionally, you can select a goal to help you structure the data. If you want to create a transformation without a specific goal and you know the structure of the output data, skip this step.
Goals will suggest you the required data for the import into Synerise.
Add file with sample data
This step allows you to add a data sample. In further steps, you define how the data will be modified. Later, when this transformation is used in the Automation workflow, the system uses the rules created for the sample data as a pattern for modifying actual data.
- Upload the
.XMLfile created as the part of prerequisites. - You can preview the file, then click Apply.
Add the new column
- On the right panel, click Add step.
- From the dropdown list, select Add Column.
- Click the Add Column step.
- In the configuration of the step:
In the Add Column field, enter the name of the column. In this use case, it's
discounted.- From the dropdown list, select Dynamic value.
- In the Type value box, add the Jinja code, which adds the
truevalue for all products withg:sale_priceattribute in this new column. You can use the code presented below:
{% if root["g:sale_price"] is defined %}true{% endif %} - Leave last select at default (Skip row if error occurred) to skip missing or invalid data which may occur during transformation.
- Confirm by clicking Apply.
Add the new column
- On the right panel, click Add step.
- From the dropdown list, select Add Column.
- Click the Add Column step.
- In the configuration of the step:
In the Add Column field, enter the name of the column. In this use case, it's
percentage_discount.- From the dropdown list, select Dynamic value.
- In the Type value box, add the Jinja code, which counts the percentage value of the discount based on
g:priceandg:sale_priceattributes and adds it to this new column. You can use the code presented below:
{% if root["g:sale_price"] is defined %}{{ root["g:sale_price"]*100/root["g:price"] }}{% endif %} - Leave last select at default (Skip row if error occurred) to skip missing or invalid data which may occur during transformation.
- Confirm by clicking Apply.
Edit Values
- On the right panel, click Add step.
- From the dropdown list, select Edit Values.
- Click the Edit Values step.
- In the configuration of the step:
Select the g:availability column.
- Under Edit values by, select Replacing.
- From the dropdown below, select Dynamic value.
- In the Type value field, enter the Jinja code which replaces the value of the
g:availabilityattribute from1and0toin stock/out of stock:
{% if root['g:availability'] == 1 %}in stock{% else %}out of stock{% endif %} - Leave last select at default (Skip row if error occurred) to skip missing or invalid data which may occur during transformation.
- Confirm by clicking Apply.
Preview and save the transformation
- Preview the results in the Output tab.

The preview of modifications to the file - In the upper right corner, click Save.
Result:

The transformation configuration
Create a workflow
The scenario for this use case describes a one-time import of the .XML file with a product database to Synerise.
- Go to
Automation Hub > Workflows > New workflow.
- Enter the name of the workflow.
Define the launch date
- As the trigger node, add Scheduled Run.
In the configuration of the node:
- Select the Run once option.
- Select Immediately.
- Confirm by clicking Apply.

The configuration of the Scheduled Run node
Select file to import
- Add a Local File node.
- In the configuration of the node:
- Upload the file.
- Confirm by clicking Apply.

Select the transformation
- Add a Data Transformation Studio node.
- In the configuration of the node, keep the default From workflow context option.
- In the editor, click Templates library:
- Select the transformation you have created before.
- Click Use template.
- Confirm by clicking Apply.

TIP: You can also create a transformation directly in the Data Transformation Studio node instead of selecting a template.
Add import to catalog
- On the Data Transformation Studio node, click THEN.
- From the list that opens, select Synerise > Import to Catalog.
- Open Import to Catalog node.
- Choose the catalog from the list.
- As a primary key, choose
g:idparameter. - Click Apply.
Add the finishing node
- Add the End node.
- In the upper right corner, click Save & Run.

The workflow configuration
Check the use case set up on the Synerise Demo workspace
You can check the transformation and automation process directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the Synerise Demo workspace (1590), where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact form to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
Generated events
This use case generates approximately 5 events per workflow execution:
automation.clientStartPath (~1), automation.clientPathStep (~3), automation.clientEndPath (~1).