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]
5.10.0
list(expression_list)
This function returns the evaluated format of each of its comma-delimited argument list of expressions.
Expression arguments can be:
- Literal values:
Fred
- though there's little point in using these unless the list is subsequently to be concatenated to a String. - Basic literal operations
"Fred"+" " +Smith"
. - Arithmetic operations:
6/2
. - Attributes
$Name
, including user attributes$MyNumber
. - Action operators
sqrt(2)
. - Action code expressions, as in whole code expressions
"Date: "+date("today").format("*")
.
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 19!
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 geting 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.