6.1. Expression Editor
Expression is a set of SQL statements returning single value.
You may create expressions to perform arithmetic calculations as well as to set values for specific columns or fields. The expressions can be created using Expression Editor.
During import procedure Expression Editor is available on the 5th step of import where you assign the columns of .csv file to appropriate fields of database. The option can be reached from the selected (highlighted) field or from the lower part of the Linking step as you can see in the illustration below:
If you press Editor button, Expression Editor page will be opened
To create an Expression use:
[FIELD_VALUE], representing the current field value from your database
[CSV_COL(INDEX)] , retrieving value from .csv file from the specified column in the INDEX parameter
CONCAT([CSV_COL(INDEX1)], '|', [CSV_COL(INDEX2)], '|' , ... , [CSV_COL(INDEXN)]) , merging values from .csv file from the specified column in the INDEX parameter, can be used to specify full category tree required for import
To increase the product price from your database by 15%, use the formula [FIELD_VALUE]*1.15
To increase the price specified in the .csv file, use the formula [CSV_COL(INDEX)]*1.15, where the INDEX is the number of the .csv column.
To change In Stock/Out of Stock field depending on product quantity, use this formula: IF([CSV_COL(INDEX)] < 3, 0, 1). In this case, if the product quantity is < 3, set value 0 for field "in stock" else set value 1. Note that in this case the ID of product quantity column from .csv file should be set at INDEX.
To merge categories using Expression field (is recommended to use with Automated Product Import), please, find the "Category Name" field and use this formula:
CONCAT([CSV_COL(1)], '|', [CSV_COL(2)], '|' , ... , [CSV_COL(N)])
where: [CSV_COL(N)] is the separate column of .csv file with the category name (N is the column number or sort order)
'|' - is category delimiter (which has been chosen at the previous step)
For more details, click SQL Help button (F1)
To check if your expression is correct, use Execute Expression option, specify any value and check the result. You can execute it as many times as you need until you get necessary result.
NOTE*: This option requires some SQL skills. In case you need assistance, you're welcome to contact us via e-mail and we'll gladly guide you through the process for a reasonable fee.