Here you can check all the operations available for the Macro editor feature.
Math operations
Math operations allow you to modify your price or stock attribute values.
Convert to text
It allows you to modify the format from number to string.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '99.95' (A format is a number)
Define the following operations:
convert to text
As a result, you get the following:
'99.95' (A format is a string)
Multiply by
It allows you to multiply an attribute value with a number.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '99.95'
Define the following operations:
multiply by
number 10
As a result, you get the following:
'999.5'
Divide by
It allows you to divide an attribute value with a number.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '99.95'
Define the following operations:
divide by
number 10
As a result, you get the following:
'9.995'
Plus
It allows you to add a number to an attribute value.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '99.95'
Define the following operations:
plus
number 23
As a result, you get the following:
'122.95'
Minus
It allows you to substruct a number from an attribute value.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '99.95'
Define the following operations:
minus
number 50
As a result, you get the following:
'49.95'
Format number
It allows you to format an attribute value to a specific decimal precision. You can select a separator and a thousand separator. The format number operation result is in a text format.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '6300.953'
Define the following operations:
format number
decimals - '2'
decimal separator - '.'
thousand separator - ','
As a result, you get the following:
'6,300.95'
Round number
It allows you to round an attribute value to a specific decimal precision. The round number operation result is in a number format.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '6300.953'
Define the following operations:
round number
precision - '2'
As a result, you get the following:
'6300.95'
Round price
It allows you to round an attribute value to a specific value. You can use the 'calculate' parameter to round to:
closest
down
up
You can round to values:
.01
.10
.25
.50
.75
.99
whole number
The round number operation result is in a number format.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '6300.953'
Define the following operations:
round price
calculate - 'closest'
to - '.10'
As a result, you get the following:
'6301.10'
Percent %
It allows you to modify an attribute value depending on the percentage. You can use the 'calculate' parameter to:
increase by - e.g., increase price by a specific percentage
decrease by - e.g., decrease price by a specific percentage
calculate - - e.g., calculate a specific percentage from the price
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '100.00'
Define the following operations:
percent %
calculate - 'increase by'
percent % - '10'
As a result, you get the following:
'110.00'
Convert to currency
It allows you to convert an attribute to a specific currency. Koongo updates the currency exchange rate twice a day from the currency exchange server.
Example:
Use attribute as input to the macro:
Price final include tax - attribute value '100.00'. The store currency is EUR.
Define the following operations:
convert to currency
to - 'USD'
As a result, you get the following:
'107.81'
Math attribute operations
Math attribute operations allow you to apply math operations between 2 attributes.
Multiply by
It allows you to multiply two attribute values.
Divide by
It allows you to divide one attribute value by another attribute value.
Plus
It allows you to add two attribute values.
Minus
It allows you to subtract one attribute value from another attribute value.
Text operations
Convert to number
It allows you to modify the format from string to number.
Example:
Use attribute as input to the macro:
Cost per item - attribute value '115', the export format is a string
Define the following operations:
convert to number
As a result, you get the following:
'115', the export format is a number
Count text length
It gives you the length of the attribute value.
Example:
Use attribute as input to the macro:
Description - attribute value 'There's a shell toe for every season, and the adidas Originals Superstar 80s'
Define the following operations:
count text length
As a result, you get the following:
'76' - the length of the attribute value
Extract text
It allows you to extract text from a certain index and of a certain length.
Example:
Use attribute as input to the macro:
Description - attribute value 'There's a shell toe for every season, and the adidas Originals Superstar 80s'
Define the following operations:
extract text
start '0' - start parameter takes a character index, 1. character has an index 0
length '100' - first 100 characters are exported
As a result, you get the following:
'There's a shell toe for every season, and the adidas Originals Superstar 80s shoes have a full grain'
Extract text after/before
It allows you to extract text between two specific words.
Example:
Use attribute as input to the macro:
Description - attribute value 'Flexfit Mini Ottoman Cap'
Define the following operations:
remove all HTML characters - removes HTML characters from the Description value
extract text after/before
prefix - 'Mini' - removes everything before and including this text
suffix - 'Cap' - removes everything after and including this text
trim whitespace on start and end - removes whitespace from the result
As a result, you get the following:
'Ottoman'
Append suffix
It allows you to append a specific text to an attribute value.
Example:
Use attribute as input to the macro:
Description - attribute value 'Flexfit Mini Ottoman Cap'
Define the following operations:
append suffix - ' - NEW'
As a result, you get the following:
'Flexfit Mini Ottoman Cap - NEW'
Append prefix
It allows you to append a specific text before an attribute value.
Example:
Use attribute as input to the macro:
Description - attribute value 'Flexfit Mini Ottoman Cap'
Define the following operations:
append prefix - 'NEW - '
As a result, you get the following:
'NEW - Flexfit Mini Ottoman Cap'
Create collection with attribute
It allows you to combine two attribute values.
Example:
Use attribute as input to the macro:
Description - attribute value 'Flexfit Mini Ottoman Cap'
Title - attribute value 'Flexfit Red'
Define the following operations:
create collection with attribute
combine with - Title
convert collection into text
join with - ' - '
As a result, you get the following:
'Flexfit Mini Ottoman Cap - Flexfit Red'
Replace in value
It allows you to replace a specific text with different text. If you fill in the 'search for text' and leave 'replace with' empty, the text will be removed.
Example:
Use attribute as input to the macro:
Description - attribute value 'Flexfit Mini Ottoman Cap old'
Define the following operations:
replace in value
search for text - 'old'
replace with - 'new'
As a result, you get the following:
'Flexfit Mini Ottoman Cap new'
Map attribute value
It allows you to map your store values to marketplace values if the marketplace approved values are available for the specific marketplace attribute.
Example:
Use attribute as input to the macro:
Product type - list of store product type values
Define the following operations:
select 'Product type' attribute
map attribute value
click 'All Unmapped'
select the appropriate marketplace value from the approved value list
As a result, you get the following:
your store attribute values are replaced by the marketplace approved values
Color Mapping Example:
Split text to collection
It allows you to split an attribute text value into a collection based on a specific separator. You need to apply additional operations to work with this collection.
Example:
Use attribute as input to the macro:
Tags - attribute value 'adidas, autumn, egnition-sample-data, men, spring, summer'
Define the following operations:
split text to collection
split on - ','
take first element as string
As a result, you get the following:
'summer'
Text operations
It allows you to apply additional operations like :
trim whitespace on start and end
Removes whitespace on start and end of the text value.
Example:
Use attribute as input to the macro:
Title - attribute value ' Flexfit mini ottoman cap '
Define the following operations:
trim whitespace on start and end
As a result, you get the following:
'Flexfit mini ottoman cap'
upper case only first character
Changes the first character to uppercase.
Example:
Use attribute as input to the macro:
Title - attribute value 'flexfit mini ottoman cap'
Define the following operations:
upper case only first character
As a result, you get the following:
'Flexfit mini ottoman cap'
upper case first character of each word
Changes all first characters at each word to uppercase.
Example:
Use attribute as input to the macro:
Title - attribute value 'flexfit mini ottoman cap'
Define the following operations:
upper case first character of each word
As a result, you get the following:
'Flexfit Mini Ottoman Cap'
upper case all characters
Changes all characters to uppercase.
Example:
Use attribute as input to the macro:
Title - attribute value 'flexfit mini ottoman cap'
Define the following operations:
upper case all characters
As a result, you get the following:
'FLEXFIT MINI OTTOMAN CAP'
lower case all characters
Changes all characters to uppercase.
Example:
Use attribute as input to the macro:
Title - attribute value 'Flexfit Mini Ottoman Cap'
Define the following operations:
lower case all characters
As a result, you get the following:
'flexfit mini ottoman cap'
remove all non-numeric characters
Removes all non-numeric characters.
Example:
Use attribute as input to the macro:
Title - attribute value 'ADIDAS | SUPERSTAR 80S live3'
Define the following operations:
remove all non-numeric characters
As a result, you get the following:
'803'
remove all HTML characters
Removes all HTML characters from the text.
Example:
Use attribute as input to the macro:
Title - attribute value '<p>Flexfit <strong>Mini Ottoman</strong> Cap</p>'
Define the following operations:
remove all HTML characters
As a result, you get the following:
'Flexfit Mini Ottoman Cap'
remove all numeric characters
Removes all numeric characters.
Example:
Use attribute as input to the macro:
Title - attribute value 'ADIDAS | SUPERSTAR 80S live3'
Define the following operations:
remove all numeric characters
As a result, you get the following:
'ADIDAS | SUPERSTAR S live'
remove all whitespaces
Removes all whitespaces.
Example:
Use attribute as input to the macro:
Title - attribute value 'ADIDAS | SUPERSTAR 80S live3'
Define the following operations:
remove all whitespace
As a result, you get the following:
'ADIDAS|SUPERSTAR80Slive3'
remove all linebreaks
Removes all linebreaks.
Example:
Use attribute as input to the macro:
Title - attribute value 'ADIDAS | SUPERSTAR 80S live3\n'
Define the following operations:
remove all linebreaks
As a result, you get the following:
'ADIDAS | SUPERSTAR 80S live3'
remove special characters
Removes special characters from the attribute value.
Example:
Use attribute as input to the macro:
Title - attribute value ' Flexfit mini ottoman cap~'
Define the following operations:
remove special characters
As a result, you get the following:
'Flexfit mini ottoman cap'
Collections
A collection in Macro Editor is a group of values stored in a list, where every value has its index (0,1,2,3 etc.) These product data can be of any type, such as numbers or strings. Collections are used to efficiently manage product data and perform operations on them, such as searching, sorting, slicing, and filtering.
Examples of using collections might be:
There are several different size attributes - e.g., Size, Size_shirts, Size_shoes, etc. First, you group the attribute into a collection. A collection for a specific item can look like [ '', '36', ''], where '' means empty. Then, you can use any collection operations below - e.g., 'First not empty item'.
As a result, the '36' value is exported to the feed attribute for a specific item.
The Collection operations allow you to work with multiple attributes or a group of values.
Sort
The 'sort' operation allows you to sort a collection alphabetically that arises from text operations or by merging several attributes into a collection.
Example:
Use multiple attributes as input to the macro:
'Category name' - attribute value 'Shoes'
'Title' - attribute value 'ADIDAS'
Define the following operations:
'sort(ascending)'
'take first element as string'
As a result, you get the following:
'ADIDAS'
Slice collection items
The 'slice collection items' operation allows you to select specific elements from a collection. If the length is not filled, Koongo selects all elements to the end. Take From is indexed from 0, so the first element in the field has a position of 0.
Example:
Use multiple attributes as input to the macro:
'Category name' - attribute value 'Shoes'
'Title' - attribute value 'ADIDAS'
'Category id' - attribute value '1234'
Define the following operations:
'slice collection items'
take from - '1' (You need to select an index from where the slice should start. The first position has index 1.)
length - '2'
'take first item as text'
As a result, you get the following:
'ADIDAS'
Take first item as text
The 'take first item as text' operation allows you to select the first element from a collection. The element is transferred to the 'string' format automatically. If you need a 'number' format, please use the 'cast as number' operation.
Example:
Use Tags attribute as input to the macro:
'Tags' - attribute value 'adidas, backpack, egnition-sample-data'
Define the following operations:
'split text to collection'
split on - ','
'Take first item as text'
As a result, you get the following:
'adidas'
Take last item as text
The 'take last item as text' operation allows you to select just the last element from a collection. The element is transferred to the 'string' format automatically. If you need a 'number' format, please use the 'cast as number' operation.
Example:
Use Tags attribute as input to the macro:
'Tags' - attribute value 'adidas, backpack, egnition-sample-data'
Define the following operations:
'split text to collection'
split on - ','
'take last item as text'
As a result, you get the following:
'egnition-sample-data'
Remove empty elements
The 'remove empty elements' allows you to delete empty values from a collection.
Example:
Use multiple attributes as input to the macro:
'Category name' - empty value
'Title' - attribute value 'ADIDAS'
'Category id' - attribute value '1234'
Define the following operations:
'remove empty elements'
'take first element as string'
As a result, you get the following:
'ADIDAS'
Convert collection into text
The 'Convert collection into text' allows you to create a text from a collection separated by a selected separator. The separator can be a space.
Example:
Use Tags attribute as input to the macro:
'Tags' - attribute value 'adidas, backpack, egnition-sample-data'
Define the following operations:
'split text to collection'
split on - ','
'convert collection into text '
join with - '-'
As a result, you get the following:
'adidas/backpack/egnition-sample-data'
Unique collection
The 'unique collection' operation allows you to remove duplicate items from the collection. As a result, unique items will remain in the collection.
Example:
Use multiple attributes as input to the macro:
'Category name' - attribute value 'ADIDAS'
'Title' - attribute value 'ADIDAS'
'Category id' - attribute value '1234'
Define the following operations:
'unique collection'
'serialize collection to text'
As a result, you get the following:
['ADIDAS','1234']
Serialize collection to text
The 'serialize collection to text' operation allows you to serialize the collection into a JSON format. You can use it for a simple serialization.
Example:
Use multiple attributes as input to the macro:
'Category name' - attribute value 'ADIDAS'
'Title' - attribute value 'ADIDAS'
'Category id' - attribute value '1234'
Define the following operations:
'serialize collection to text'
As a result, you get the following:
['ADIDAS','ADIDAS','1234']
First non-empty item
The 'first non-empty item' operation allows you to select the first non-empty value. You can use it, for example, to search through several attributes - Return the first non-empty value.
Example:
Use multiple attributes as input to the macro:
'Category name' - empty value
'Title' - attribute value 'ADIDAS'
'Category id' - attribute value '1234'
Define the following operations:
'first non-empty item'
As a result, you get the following:
ADIDAS