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

List.unique


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Property   [other Property type actions]

 Item   [operators of similar scope]

 Data manipulation   [other Data manipulation operators]

 Baseline

 


List.unique()

This returns a List of the unique values in the list - i.e. an unsorted but de-duped list. Hitherto, de-duping required passing data into a Set-type attribute and back. Trailing parentheses are optional for this property.

If $MyList is 'ant;bee;cow;bee':

$MyList = $MyList.unique 

gives 'ant;bee;cow'. The property can be chained with .sort and .reverse.

$MyList = $MyList("Another note").unique $SomeList = collect(children, $MyList).unique $MyList = collect(children, $MyList).unique

The last above sets $MyList to a list of all the unique, discrete, values to be found in $MyList in every child of the current note. Use with collect() or collect_if() to act on a particular attribute across a group of notes. If a collect() with query scope is the designator 'all' the result will be every discrete value for the referenced list attribute across the whole document.