How to access to the functions list from the interface? In a channel > "Match your products attributes" > from each channel field > "How to fill in this value? " tooltip > "Need function?" link
1. Text functions
Example: I want all the characters sent to the channel field "title" to be in capital letters.
Example: I want all the characters sent to the channel field "title" to be in lower-case.
Example: I want the first letter of each word to be a capital, in the channel field "title".
Example: I want each sentence to begin with a capital, in the channel field "title".
Syntax: TRUNC($text_field,number of characters)
Example: I want to limit my description to 2,000 characters.
Syntax: SMARTTRUNC($text_field,number of characters)
Example: I want to limit my description to 2,000 characters without cutting off the last word.
Syntax: TAIL($text_field,number of characters)
This function is useful to isolate the last characters of a string and use them as value in my catalog.
Example: I want to get the last 4 characters of my product type.
Syntaxe : SPLIT($text_field,separator, field number)
This function is useful to isolate a part of the text of a string starting from the left of the string in order to isolate this part of text and use it as a value in my catalog.
Exemple : I want to isolate the the value Plug&Play in the "product_type" field.
$text_field = Plug&Play, SPLIT($text_field, &, 1) => Plug
$text_field = Plug&Play, SPLIT($text_field, &, 2) => Play
Example: I want to remove the html tags from my description.
Example: I want to add the title of my products in the tracking of my URL products.
This function is useful if you have a breadcrumb categorization, ie if you have several levels of categories in the same line.
Ex : Home > Fashion > Shoes > Nike shoes
The function then allows you to select a level and extract it to use it as a final category with your channel in Lengow.
Syntax : CATEGORYLEVEL(2)
With this syntax we get the second value of my category, "Fashion" thanks to the function.
Other syntax : CATEGORYLEVEL(-1)
Here I retrieve the last level of categorization, ie "Nike shoes" thanks to the value "-1" called in the function.
Other syntax : CATEGORYLEVEL(-2)
Allows me to retrieve the penultimate level, ie "Shoes".
Note: There is no need to "call" the catalogue category using the $ symbol because Lengow automatically retrieves the values of the category matched during the Matching Lengow step.
Syntax: ROUND(number to round up/down,number of figures desired after the decimal point)
Round up/down the number, to the nearest tenth, hundredth...of a decimal number, cutting down to the stated rank then:
- if the following number is 5, 6, 7, 8 or 9, you increase the last figure of the cut number by 1.
- if the following number is 0, 1, 2, 3 or 4, you keep the cut number.
To round up to a whole number, mark "0" as "the number of figures desired after the decimal point" or mark ROUND(numbertoround).
- To round a price to two figures after the decimal point: ROUND($field_price,2) > If my price is "14.1576" in my product catalogue, it becomes "14.16".
- To remove decimals of quantity values: ROUND($field_quantity,0) or ROUND($field_quantity) > If my quantity is "4.000" in my product catalogue, it becomes "4".
Syntax: ROUNDUP(number to round up to the nearest whole number)
Example: I want to round my price up to the nearest whole number:
Syntax: ROUNDDOWN(number to round down to the nearest whole number)
Example: I want to round my price down to the nearest whole number:
Syntaxe : FORMAT_NUM($price$,decimal digit wanted,"separator wanted")
- Decimal separator accepted: a point or a comma
Exemple : I want to display a price with two decimal digits
You can couple this function with the other mathematical functions.
To do so, check the step "Concatenate several functions".
FORMAT_NUM allows you the display of this "0".
- Divide: CALC(number1/number2)
- Multiply: CALC(number1*number2)
- Addition: CALC(number1+number2)
- Subtraction: CALC(number1-number2)
"number1" and "number2" can be replaced by "$my_field"
With the assistance of brackets, any calculation can be performed. The function performs the calculations in order of priority.
Example: I want to calculate the reduction percentage of my reduced products.
I want to increase my sales price by 10%, round it up to the nearest whole number, and subtract 10 cents.
I want to reduce my sales price by 15% and add my shipping costs increased by 5%.
Example: I want to convert a price into GBP.
Conversion rates are based on the European Central Bank (ECB) and are updated once a day.
3. Concatenate several functions
Combine as many functions as you like whilst playing with the brackets!
Example: I want to increase my sale price by 10% and round the result by two figures after the decimal point
Example: I want to limit my description to 2,000 characters and write the text in capitals.
Example: I want to increase my sales price by 10% and convert it into euros.
Example: The text of my descriptions is in upper-case letters. I want the first letter of each phrase to be an capital letter, whereas all the other letters will be lowercase letters.
Example: I want to round to two digits after the comma, the percentage of the product promotion, calculated from the stricked through price and reduced price from my catalog.
In this example "Full_price" is the field which contains the price before the promotion and "Prix_Promo" is the field which contains the reduced price (product price during the promotion).
Example: I want to round down the price plus 20% and add the decimal .99 to apply a psychological price.
In this example, "price" is the products catalogue field which contains the product selling price.