Returns the lowest value from a group of items that has the lowest value for a specified attribute.
Syntax
min_with_min(value, order_value)
Parameters
value
: Any type of attribute or column (number, text or boolean). The function returns the highest value of this attribute for one of the selected items.order_value
: Any type of standard attribute or custom attribute (number, text or boolean), though typically you specify numeric or monetary attributes. The function selects all items that share the highest value of this attribute.
If you specify a text attribute, the function first sorts by lexicographic order, then it selects items at the beginning of the sort list.
Example
An ad group that's scoped to the 'MyBrand' brand contains the following items:
BRAND | TITLE | PRICE | DISCOUNT |
---|---|---|---|
MyBrand | Red shoes | $10.00 | 10% |
MyBrand | Yellow shoes | $10.00 | 10% |
MyBrand | Blue shoes | $10.00 | 5% |
MyBrand | Crew socks | $5.00 | 20% |
MyBrand | Dress socks | $5.00 | 20% |
MyBrand | Knee-high socks | $5.00 | 15% |
In an ad template,
[to_text(min_with_min(DISCOUNT, PRICE))]
does the following:
- Scans the
PRICE
column and finds the items that share the lowest price.
In this case, the function selects 'Crew socks', 'Dress socks' and 'Knee-high socks' (which all specify a price of £5). - Scans the
DISCOUNT
column for 'Crew socks', 'Dress socks', and 'Knee-high socks' and returns the lowest value.
In this example, the function returns 15 ('Knee-high socks' have a 15% discount).