Used for: Calculations on group level rather than individual item level.
Used in: "THEN"-statements and "ELSE"-statements.
General improvement
The four new rules are all a subset of rules under the 'parent rule' called: "Calculate item group"
You can use these rules without having to group the items beforehand. You can use these rules on 'groups' of items that share values in a certain field. The most obvious one is 'item_group_id', but you can also create your own 'groups' of items.
Count items
The first rule is called 'count items'. What this rule does is count the amount of products/items within a certain group. To explain it a little better, below is a screenshot of what this rule will look like in the tool.
As you see, you first choose a mutual id or some field which is similar to the group, in this case, 'item_group_id'. Then you can select the rule itself and choose a field in which it will store the result of the calculation.
The result of this rule will always be a number, e.g. the number of products in the product_group. As you can see below:
As an example of where you can use this rule, besides what was explained above: It is also possible to start counting from a new field that is common amongst a group. For example, for vacancies, you might want to make a group of 'branch + city' and count how many vacancies you have for a certain branch in a certain area. Or even for real estate, you can make a group of 'type of house + area' and count how many houses of that type you have in a certain area.
Calculate sum
The second rule is called 'calculate sum'. This rule will calculate the sum of a specific field of all the items within a group.
To elaborate a bit more on this. Let's say we have 10 items, which have the same 'item_group_id'. This means we can call this 'the group'. Every item in this group has a specific amount set as 'stock quantity', if you want to know all the stock of this group you can use this rule.
Again first you choose the 'group_id' of the group (in this example we used 'item_group_id'). Then select the rule 'calculate sum', next you can select the field in which you want to calculate the sum. This field will always have to be a number since you are calculating the 'sum of something'. (In this example we're using 'Stock')
The result of this rule will be the total amount of stock of all the products in the group. So if every product in the group had a stock quantity of 3, the result of this rule will be 30.
Find highest / lowest value
The final two rules are essentially the same. The first one here is 'find highest value' and the other is 'find lowest value'. These are the opposite of one another.
'Find lowest value' will find the lowest value of a specific field of the item group. It will fill the chosen field with the lowest value of the specified field spanned across all items in the item group.
As you can see, first you specify the rule 'find lowest value'. Then you will choose the field in which you want to find the lowest value and a field where you want to store this value in.
Let's say you have 10 products that are similar, for example, Flights. Now you can imagine that the same flight will be available on different dates for different prices but you want to make an ad saying "All flights to X destination, available from "lowest price". With this rule, you now can easily find the lowest price among a group of products.
Another example could be that this rule allows you to make specific ads for a certain group of items. Let's say you want to advertise a certain bracelet, you can use this rule to find the lowest price amongst all bracelets within a certain category or brand. Then the ad can say something like "Find all our other bracelets of brand X, starting from 'lowest_price_of_brand'.
In a way, the above was already possible with the 'deduplicate rule'. The big difference, however, is that with these rules you will keep all the items and not only keep the highest or lowest.
The 'find highest value' rule will do exactly the opposite of the above rule.