This version is out of date, covering development from v6.0.0 to v6.6.5. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

TinderboxSix Icon

List/Set.max


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Property   [other Property type actions]

 List   [operators of similar scope]

 Data manipulation   [other Data manipulation operators]

 6.4.0

 


List/Set.max

The List/Set.max() operator returns the largest item in a List or Set data type attribute.

This is a replacement for/alternative to the max() operator.

Both the operators List/Set.max and List.Set.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=("1;100;2").max 

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

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

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

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

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

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

This allows export via ^value^:

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

When using Date-type data bear in mind that the unset Date default is "never" and that "never' is always before (i.e. less than) any set date. So to use .max with dates, filter out the unset values:

$MyMin = collect_if(descendants,($Modified!="never"),$Modified).min 

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

Works: $MyNum = list(4+2,9+6).max (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)).



A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : List/Set.max