This version is out of date, covering development from v5.0.0 to v5.12.2. It is maintained here only for inbound reference links from elsewhere.

Jump to the current version of aTbRef.

Tinderbox Icon

max(list)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 List   [operators of similar scope]

 Mathematical   [other Mathematical operators]

 Already in v5.0.0

 5.6.0


max(list)

The max() operator returns the largest item in a List or Set data type attribute. Prior to v5.6.0, this operator required Set data.

Both the operators max() and min() use lexical comparison in most cases, but numeric comparison if the context is numeric (i.e. the target is a Number-type attribute) and/or all list items are numbers. Thus:

$Width=max("1;100;2") 

Since "Width" is numeric, max() will be return 100.

$Name=max("1;100;2") 

Since the attribute "Name" is a string, max() will return 2.

If you don't have a set, create one on the fly:

$MyMax = max(collect(all,$MyNum)) 

$MyMax = max(collect(descendants,$Modified)) 

This allows export via ^value^:

^value(max(collect(descendants,$Modified)))^ 

To use max() with a list of items that are attributes or expressions, use list():

Works: $MyNum = max(list(4+2,9+6)) (output: 15)

For more complex examples, where list items are action code expressions, it may be necessary to use eval() to wrap each list item expression e.g. list(eval(expressionA),eval(expressionB)).


Possible relevant notes (via "Similar Notes" feature):


A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : max(list)