any_with_max

any_with_max returns a value from an item that has the highest value for a specified attribute.

Note: This function is only available in Templates and can’t be used in Reporting.

Syntax

any_with_max(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 attribute. The function selects all items that share the highest value of this attribute.

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, [any_with_max(TITLE, PRICE)] does the following:

  1. Scans the PRICE column and finds the items that share the highest price.
    In this case, the function selects "Red shoes", "Yellow shoes", and "Blue shoes" (which all specify a price of $10).
  2. Returns the value of the TITLE attribute for one of those items. That is, the function returns either "Red shoes", "Yellow shoes", or "Blue shoes".

Related links

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Main menu
3024512351223527025
true
Search Help Center
true
true
true
true
true
5055977
false
false