Transformation script editor supports the following views:
Code View – This is where you write the script for data transformations
Tool View – This is where you can select a wide range of operations and automatically perform data transformations without writing any scripts. In this case, the python scripts are automatically generated.
To write scripts to perform data transformations (via Code view):
Click Script.
Click Edit Script.
Click Code View.
Enter the code.
If you want to preview the output of your code, click Preview Output.
Click Save.
To automatically perform data transformations (via Tool view):
Click Script.
Click Edit Script.
Click Tool View.
The Property list displays all the available product properties.
If you want to view the sample values of a property, click Show sample values.
The sample values appears on the right side of the window. If you want to view sample values for other properties from here, select another property, and then click .
In the Select Operation list, select an operation for the data transformation. The operations are:
Operations
Sample Scenario
Steps
Replace
Replace all occurrences of “Crimson” for the property “Color” with “Red”
In the Select Operation list, select Replace.
In the Replace Value box, type the property value you want to replace.
In the Replace With box, type the new value.
Join
Join two properties “ Brand” and “Product Name” using the joining value “-”
In the Select Operation list, select Join.
In the Join by Value box, type the character you want to use to join the the two property values.
In the Property box, select the second property.
Prefix
Prefix (add something at the beginning) US currency “$” for the property “Price”
In the Select Operation list, select Prefix.
In the Prefix With box, type the character you want to add before the property value.
Suffix
Suffix (add something at the end) registered trademark to the values of the property “Product Name”
In the Select Operation list, select Suffix.
In the SuffixWith box, type the character you want to add after the property value.
Split & pick
Split the property “Image URL” and pick the image name
Split the image url with “/” and pick the image name “174833handbag.jpg”
When you specify the “split by” value as “/” and the “pick position” value as “6”, and execute the script, the url first splits into the following:
– https: (Position 0)
– Empty space (Position 1)
– xyz.shopc.com (Position 2)
– LCProdThumb (Position 3)
– 17 (Position 4)
– 4 (Position 5)
– 174833handbag.jpg (Position 6)
The result will be 174833handbag.jpg
In the Select Operation list, select Split and Pick.
In the Split by box, enter the character using which you want to split property value.
In the Pick item at position box, enter the position number using which you want to pick the specific part of the property value.
Addition
Add two numerical property values for properties “ Base Price” and “Delivery Charges”. That is,
Actual price = Base price + Delivery charges
In the Select Operation list, select Addition.
In the Property box, select the property you want to use for addition.
To include multiple properties for addition, click .
Subtraction
Subtract two numerical property values for properties “ Actual Price” and “Discounted Price”. That is, Offer Price= Actual Price- Discount Price
In the Select Operation list, select Subtraction.
In the Property box, select the property you want to use for subtraction.
To include multiple properties for subtraction, click .
Multiplication
Multiply two numerical property values for properties “Number of Units” and “Price per Unit”. That is, Total Price = “Number of Units” * “Price per Unit”
In the Select Operation list, select Multiplication.
In the Property box, select the property you want to use for multiplication.
To include multiple properties for multiplication, click .
Division
Divide two numerical property values for properties “Total Weight of the Products” and “Total Weight of the Carton”. That is, Per Unit Weight = Total Weight of the Products / Total Weight of the Carton
In the Select Operation list, select Division.
In the Property box, select the property you want to use for division.
To include multiple properties for division, click .
Percentage
Get % portion of a particular property value. That is,
Offer Price= 80% of Actual Price
In the Select Operation list, select Percentage.
In the Percentage portion box, enter the percentage value.
Round off
Round off the property values of a property “Weight” upto two decimal places
That is, the value 114.7261 will become 114.73
In the Select Operation list, select Round off.
In the Round off to box, enter the value for the decimal places.
If you want to combine another operation with the previous operation, click Add another operation.
If you want to copy the automatically generated code, click Copy Code.
If you want to preview the output of your code, click Preview Output.