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

min(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


min(list)

The min() operator returns the smallest 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=min("100;2;70") 

Since "Width" is numeric, min() will be return 2.

$Name=min("100;2;70") 

Since the attribute "Name" is a string, mix() will return 100.

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

$MyMin = min(collect_if(all,$MyNum>0,$MyNum)) 

$MyMin = min(collect(descendants,$Modified)) 

This allows export via ^value^:

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

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 min() with dates, filter out the unset values:

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

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

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

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 : Action Operator Scope : List-based operators : min(list)