How to ...‎ > ‎

3. How to Use Expressions?

fmExpressionEditor 


Expressions are mathematical equations so they can be used only for numeric fields such as price, quantity etc. You should not use them for description, design etc. This feature can be used for faster updates.

Expressions can be used for calculations and allow to specify simple calculation for numeric fields. Expressions can be used while import or while mass operations made by Mass Product Changer (Store Manager Addon):

1. How to use expressions while import

On the step of linking columns from .csv file to appropriate database fields you can also use expressions for calculating filed values ( e.g. add some amount to the supplier's price)
To open Expression editor find field "Expression"  and click "Editor" button.


To create the expression you may use necessary column of .csv file [CSV_COL(INDEX)], where INDEX denotes the number of the column; and [FIELD_VALUE] for current value of the field.

Examples:
  • To calculate field values use =[CSV_COL(7)]*1.2 - [FIELD_VALUE] formula, where operand CSV_COL(7) represents the data from the number of column (in our case #7) of .csv file and [FIELD_VALUE] for current value of the field in database.
If in column #7 we have value 10 and in DB filed - 9, then using the formula mentioned above we shall receive - 10 * 1.2 - 9 = 3
  • To change the price of the product you may also use expressions.
Let’s assume we want to rise the price for the selected products by 10%.
To calculate field value you have yo use certain arithmetical formula [FIELD_VALUE]*1.1, or if you would like to increase price that specified in .csv use CSV_COL(INDEX) macro, where INDEX is number of csv column


So, lets say that currently the price of your product is 10 and you want to increase it by 10%.
Using the formula we receive: 10*1.1 = 11

  • If you would like to change In Stock/Out of Stock field depending on quantity use this formula: IF(CSV_COL(INDEX)<3,0,1) this means that if quantity < 3 then set 0 value for field in stock else set 1 value.
For more details click SQL Help button (F1)


2. How to use expressions with Mass Product Changer


To use expression option in Mass Product Changer follow a few steps listed below:

1. Select the products you want to update. Click right mouse button to call context menu and choose Mass Product Changer


2.  In the opened Mass Product changer window choose "All fields" section and the product attribute  that should be updated.
3. Use expression field to change your data more deeply



For example: Let’s assume we want to rise the price for the selected products by 10%.
To calculate field value you have yo use certain arithmetical formula, in which operand "x" represents value from .csv file whereas 1.1 denotes level of increasing by 10% (1.2 by 20% etc.).
e.g. x*1.1
Then press "Set" to apply the formula to the products selected.
So, lets say that currently the price of your product is 10 and you want to increase it by 10%.
Using the formula we receive: 10*1.1 = 11




    
*
to decrease the price 
for the selected products by 10% please use field value 0.9

Store Manager performs the operation least than in a second and changes the price for the selected products by 10%.

Comments