List.unique

Tinderbox Icon


Operator Type:   Property
Operator Scope of Action:   Item
Operator Purpose:   Data manipulation

List.unique()

New to v5.9.2, 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 target 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 target list attribute across the whole document.


Possible relevant notes (via "Similar Notes" feature):

Up: Item-based operators

A Tinderbox Reference File : Actions & Rules : Operators : Action Operator Scope : Item-based operators : List.unique

Quicklinks: Attributes | Action Codes | Export Codes | Designators | Date Formats | aTbRef Site Map

[Last updated: 16 May 2012, using v5.11.1]


Search:

Google search aTbRef for:  


Creative Commons Licence

aTbRef by Mark Anderson is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

[See aTbRef CC licence Attribution & Waiver info]

Made with Tinderbox