3.5.2. Expression Editor

fmMagentoExpressionEditor, fmExpressionEditor

An expression is a set of SQL statements, returning a single value. You may create expressions to perform arithmetic calculations, and to specify algorithms to programmatically set values for specific columns, or fields. This feature will perform significantly faster updates.

Expressions are created using the Expression Editor. They can be used during discrete import processes, or during mass operations, through the use of the Products Multi Editor:

1. How to Use Expressions while Import

During the import procedure the Expression Editor is available during the 6th step of the process, in which you assign columns of the .csv file to their relative fields within the database.

To use the Expression Editor, you must choose the column, within the .csv file, which value you want to change. In the required expression field, indicate the formula that you want to apply.

Expression Field in Import Wizard

To open the Expression editor, select the "Expression" field, and click this button ->

Open Expression Editor Button
Expression Editor

To create an Expression use:

[FIELD_VALUE]

This represents the currently existing field value, within the database.

[CSV_COL(INDEX)]

It specifies the value to retrieve from within the .csv file, from the required column, specified in the INDEX parameter

CONCAT([CSV_COL(INDEX1)], '|', [CSV_COL(INDEX2)], '|' , ... , [CSV_COL(INDEXN)])

These merging values from .csv file from the specified column in the INDEX parameter, can be used to specify full category tree required for import.

Examples:

  • 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 the [SQL Help] button (F1)

2. How to Use Expressions with Products Multi Editor

To use the expression option via the Products Multi Editor, follow the steps below:

1. Select product(s) you wish to update. Right-click to bring up the context menu, and choose Multi Editors -> Products Multi Editor

Product Multi Editor Button

2. Use expression field to change your data in details:

Product Multi Editor

To open the Expression editor, find the "Expression" field, and click this button - >

Expression Editor Button

NOTE*: This option requires a level of SQL programming skill. If you need assistance, you're welcome to contact us, via email, and we'll gladly guide you through the process, for a reasonable fee.