Transform and import customers' data to Synerise
Automation capabilities in the area of data transformation can be used to update and change large amounts of data in a fast, advanced way, eliminating the process of manually adjusting the whole file. All transformations are performed on a sample file in desired format.
In this use case, you will find out how to transform and import customer data from a .JSON file with data transformation and workflows.
In this use case, you will make the following modifications to the sample file:
- Edit values:
- replace the value of the 
cityattribute from blank tounknown; if thecityattribute is defined, keep the existing city, - replace the 
en,es,frvalues of thelanguageattribute withEnglish,Spanish,French, respectively, - replace the value of 
payment_cashandpayment_onlineattributes from1/0tocash/Nullandonline/Null. 
 - replace the value of the 
 - Merge 
payment_cashandpayment_onlineattributes into thepayment_infoattribute. 
Input data in use case
In this use case, we use two files:
- the complete 
.JSONfile with your customer database. Make sure you include one of the required parameters:clientID, uuid, email, customId. The only requirement for JSON files is that they must be UTF-8 encoded. - Prepare a sample JSON file with data you want to import. Below you will find an example how such a a file can look.
 
{
      "email": "test@test.com",
      "city": "",
      "language": "fr",
      "payment_cash": "1",
      "payment_online": "0"
    },
    {
      "email": "test2@test.com",
      "city": "New York",
      "language": "en",
      "payment_cash": "0",
      "payment_online": "1"
    }Process
- Prepare data transformation rules to transform the data in the file.
 - Prepare a workflow to import the 
.JSONfile to Synerise. 
Create data transformation rules
In this part of the process, you define the rules of modifying data before sending it to Synerise, so the data is consistent. Each of the following sub-steps describes the individual changes performed on the file.
- Go to 
 Automation > Data Trasnformation > Create transformation. - Enter the name of the workflow.
 
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 diagram without a specific goal and you know the structure of the output data, skip this step.
Goals will suggest you the required fields needed to perform the import into Synerise.
Add input data
This node allows you to add a data sample. In further steps, you define how the data must be modified. Later, when this transformation is used in the Automation workflow, the system uses the rules created with the sample data as a pattern for modifying actual data.
- Click the Add input node on the canvas.
 - On the pop-up, click Upload a new file or drag one here.
 - Upload the 
.JSONfile. - You can preview the file, then click Apply.
 
Result: The Data input view is filled with data from the sample.
Handle missing data
In this part of the process, you will use the Edit values node to edit the city attribute values with Jinja code to keep the existing city and add the unknown value to the blanks.
- Add the Edit values node.
 - In the configuration of the node:
- 
Click Add rule.
 - 
Click Add column.
 - 
Select the
citycolumn. - 
Under Edit values by, from the dropdown list, select Replacing.
 - 
Under with, from the dropdown list, select Dynamic value.
 - 
In the Type value field, paste the following Jinja code:
{% if root["city"] != "" %}{{ root["city"] }}{% else %}unknown{% endif %}
The configuration of the Edit values node As a result, in the Output data tab, you will get an updated file:

Output data after applying Edit values node  
 - 
 
Change data
In this part of the process you will use the same Edit values node created in the previous part of the process, to also edit the language, payment_cash and payment_online attributes values with jinjava code to change the data. You will change the language attribute value from “en” to “English” and so on. In case of payment_cash and payment_online attributes you will change “1/0“ values to “cash/Null“ and “online/Null” to later merge them into payment_info attribute.
- 
In the configuration of the node:
- 
Click Add rule.
 - 
Click Add column.
 - 
Select the
languagecolumn. - 
Under Edit values by, from the dropdown list, select Replacing.
 - 
Under with, from the dropdown list, select Dynamic value.
 - 
In the Type value field, paste the following Jinja code:
{% if root["language"] == "en" %}English{% elif root["language"] == "es"%}Spanish{% elif root["language"] == "fr"%}French{% endif %}
The configuration of the Edit values node  
 - 
 - 
Click Add rule.
- Click Add column.
 - Select the 
payment_cashcolumn. - Under Edit values by, from the dropdown list, select Replacing.
 - Under with, from the dropdown list, select Dynamic value.
 - In the Type value field, paste the following Jinja code:
{% if root["payment_cash"] == "1" %}cash{% elif root["payment_cash"] == "0"%}{% endif %} 
 - 
Click Add rule.
- Click Add column.
 - Select the 
payment_onlinecolumn. - Under Edit values by, from the dropdown list, select Replacing.
 - Under with, from the dropdown list, select Dynamic value.
 - In the Type value field, paste the following Jinja code:
{% if root["payment_online"] == "1" %}online{% elif root["payment_online"] == "0"%}{% endif %} 
As a result, in the Output data tab, you will get an updated file:

Output data after applying Edit values node  - 
Click Apply.
 
Merge columns
In this part of the process, you will use the Merge columns node to merge payment_cash and payment_online attributes into one payment_info attribute.
- 
Click THEN on the canvas.
 - 
From the dropdown list, select Merge columns node.
 - 
In the configuration of the node:
- 
Click Add rule.
 - 
Click Add column.
 - 
Select the
payment_cashandpayment_onlinecolumns. - 
In the Merge values to new column section, in the New column name field, type the name for the new column:
payment_info. - 
Enable the Remove original columns option.

The configuration of the Merge columns node  
As a result, in the Output data tab, you will get an updated file:

Output data after applying Merge columns node  - 
 - 
Click Apply.
 - 
As the final node, add Data Output in which you will see the final result of file modifications.
 - 
Click Save and publish.
 
Prepare a workflow
The scenario for this use case involves a one-time import of .JSON file with a customer database directly to Synerise.
- Go to 
 Automation > 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:
- Change the Run trigger option to one time.
 - Select Immediately.
 - Confirm by clicking Apply.
 

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

Add Data Transformation node
- 
Add the Data Transformation node.
 - 
In the configuration of the node, select the data transformation you have created before.

The configuration of the Data Transformation node  - 
Click Apply
 
Add Import Profiles and finishing node
- 
Add the Import Profiles 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 Data Transformation and Workflow configurations 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.