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 also to specify algorithms to programatically set values for specific columns, or fields. This feature will perform significantly faster updates.
Expressions are  created using the Expression Editor.

Expressions 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 the 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, whose value you wish to change. In the required expression field, indicate the formula that you wish to apply, to achieve your desired result set.

    Expression field

To open the Expression editor, select the 'Expression' field, and click the   button.

    Expression Editor form


To create an Expression use:

[FIELD_VALUE], represents the currently existing field value, within the database
[CSV_COL(INDEX)]  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)]) , 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 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 delineated below:

1. Select the product(s) you wish to update. Click the right mouse button, to bring up the context menu, and choose Multi Editors -> Products Multi Editor
    Product Multi Editor option


2. Use expression field to change your data more deeply

Multi Editor form

To open the Expression editor, find the 'Expression' field, and click the button.

NOTE*: This option requires a level of SQL programming skill. If 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.


Take into account the following tutorials on using expression during import process:


What is Expression? How to use it performing Magento import?

By eMagicOne Inc.

Comments