Skip to main content

FAQ - Examples of rules and functions

Stéphane Jauffret avatar
Written by Stéphane Jauffret
Updated over a year ago

Rules are often used with functions, when it comes to transforming data in a "complex fashion".

Functions are used in a similar way as in a spreadsheet like Excel or Google Sheets 👇

$function_name(argument1, argument2....)

The $ symbol precedes any transformation function. It will be inserted automatically if you click on this button and select a function:

When using validation functions, they are preceded with the "?" symbol. Validation functions returns 0 or 1.

How do I add 3€ to a price column?

Here we add 3€ to the Price column when the price we submit in the input file is below 10€. If you always want to add 3€, you can omit the condition.

  • The condition looks by default at the Price column in your input file. You can change that by selecting the icon

  • The action looks at the standard_price, column name in the output file.

$add(#(standard_price),3)

How do I add two numbers, coming from different columns?

Easy alternative to the previous example, all you have to do is to give the column names as arguments to the $add function 👇

Use the "Target column" and "Transformation functions" to insert the right column names and the $add function.

$add(#(price),#(shipping price))

How do I add 10% to a price column?

Almost the same as above. You need to use the multiply function. Assuming your price column is named "Price"

$multiply(#(Price),1.10)

How do I concatenate 2 columns?

Just write them next to each other. If you want to insert a space between them, just write a space. No quotes. If you want to insert a "-", just write a "-", no quotes. Etc.

The below would concatenate brand_name column with item_name and model, separating them with a "-" sign.

The # sign means we are referring to the target template column name.

If you use the % sign, you can refer to the input file column names

#(brand_name) - #(item_name) - #(model)

How do I search and replace content?

The replace function will do what you want. Assume you want to replace "24 Delivery" by "24H Service" in the Product description column.

$replace(#(product_description),24H Delivery,24H Service)

How do I use special characters in rules, such as commas ?

Characters such as

  • commas

  • $ sign

  • % sign

  • * sign

  • # sign

Are all used as special symbols in functions. So if you need to use them as their real value, you will need to "escape" them with a \ sign

For example, if you need to replace "24 Delivery, great service" by "24H Service, great delivery" in the Product description column, the comma must be escaped like this:

$replace(#(product_description),24H Delivery\, great delivery,24H Service\, great delivery)

How do I filter out all items where column X contains ABC?

You need to select the action type icon in your rule to "Filter out". First define your condition, and then select "filter out"

How do I put one column's data in upper or lower case?

The below example puts a sku column in upper case

$upper(#(sku))

How do I insert a new line in the output file?

That is done through a rule type, not by using functions.

In some cases your file is like this:

And you want it to be like this, to insert a new line for certain rows that share a same condition. In the below example, we're inserting a "parent" line for all models of a same tee-shirt, as identified by the same "Variation Id":

Please note that the inserted lines will appear at the end of the file

How do I extract data in the form of key-value?

If your content appears gathered in one cell of your file like this:

And you want to extract it into separate cells to isolate each key in one separate column. For example, you want to get the "Material" and the "Inaltime" into separate columns. In the above examples, you would want to extract the words "Inox" and "Alama" and "Otel" for Material, and the values "79", 73" and "320" for Inaltime.

Below is a rule that does this, using the function

$extract_between_strings(%(Attribute),Material:,;)

It extracts everything between the word "Material: " and until the following ";"

Did this answer your question?