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(expression_list)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Data manipulation   [other Data manipulation operators]

 Baseline

 


list(expression_list)

This function returns the evaluated format of each of its comma-delimited argument list of expressions.

Expression arguments can be:

The function is also useful as a method of assembling lists of attributes or expressions for action functions using lists such as count(), max() and min():

FAILS: $MyDate = max($MyDateA;$MyDateB;$MyDateC)

The latter fails as max() interprets the list as 3 literal strings "$MyDataA", etc., and does a lexical sort on those values. However:

WORKS: $MyDate = max(list($MyDateA,$MyDateB,$MyDateC))

Functions creating lists (sum(), links(), collect(), etc.) don't have the same problems with the likes of max as the former output a valid list that can be used directly. For instance:

WORKS: $MyDate = max(links.outbound.attended.$MyDate)

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)).

Examples

This returns a list of numbers resulting from simple evaluations:

Code: list(4+5,9-3,100/2.5)

Output value, a list: 9;6;40

This example, this makes a single evaluated string out of a list of two expressions:

Code: list("This note 's $Width is "+$Width, "the $Xpos is "+$Xpos).format(" and ")+"!")

Output value, a string: This note's $Width is 3 and the $Xpos is 20.5!

This example is not overly complex but points to how list() can be used in constructing output strings/lists that are otherwise difficult to create. The more complex the expressions passed to list() the greater the likelihood of getting no output - or an unexpected one. If complex inputs don't work consider using more parentheses to help TB figure the order of sub-task execution or else put the result of expressions into new attributes and then pass the value of the latter into list() as a parameter.



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