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

Jump to the current version of aTbRef

Tinderbox 7 Icon

Chaining 'dot' functions

Where pertinent, the 'dot' functions (operators prefaced with a period), like .split(), can be chained together. If an operator's parentheses are normally optional, they be omitted if that operator has another operator chained to its right. Thus:

$MyList.sort().reverse() GOOD

$MyList.sort().reverse GOOD

$MyList.sort.reverse() GOOD

$MyList.sort.reverse GOOD

"Where pertinent" points to the fact that the dot operators used must act on compatible data types:

$MyList.sort().reverse() GOOD

$MyColor.red().empty() BAD

It is most likely that opportunities for chaining only occur in relation to text data functions though do be aware that some text dot operators are only for lists/sets and some only for string even though others cover both types of data.

Chaining to parentheses

It is possible to chain to parentheses and indeed is sometimes necessary. The parentheses ensure Tinderbox evaluates contents of parentheses before the dot-chained actions are applied. In this example, three strings are concatenated to a single string before its size (number of characters) is calculated:

(Hello" +" "+"world").size 

The above example is trivial but shows the general principle. In practice, the technique can become useful is the expression is complex and requires Tinderbox to fully evaluate it before processing the chained function. For instance, the links() operator already uses dot-chained parameters and so to find the number of links found using .size, it is necessary to place the whole links() expression in parentheses:

(links(children).inbound..$StartDate).size 



A Tinderbox Reference File : Actions & Rules : Chaining 'dot' functions