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

values([group,]attribute)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Group   [operators of similar scope]

 Set & List creation   [other Set & List creation operators]

 Baseline

 


values(attribute)

This returns a Set of unique values for the attribute attribute. As the output is a of Set data type, the list of possible values is de-duped thus giving a list of unique values. Any suggested values not actually used by at least one note are omitted from the list return by values().

If the named attribute is a set or list, values() returns a list of all the unique discrete list item values that occur. If the named attribute is a string, values() returns all the unique strings.

The attribute parameter is evaluated so may be:

Thus if $MyString has the value "MyList", then these are functionally equivalent:

values("MyList") 

values($MyString) 

It is envisaged that the first method (the quoted, un-prefixed, attribute name) will be the most usual method of using values().

The scope of the assessment is always across the whole document. The data is returned in case-sensitive sort order (i.e. all capitals sort before lower case letters) so chaining .isort() may often be the desired 'default'.

values() differs from collect() in that values() returns Set-type data and collect() returns List-type data. For a list $MyList, the following are functionally equivalent in output:

collect("all",$MyList).unique 

values("MyList") 

values($MyString) (where $MyString has the value "MyList")

values(group,attribute)

If an optional first group parameter is provided, the values returned are drawn only from notes in that scope. The reference point for groups like 'children' or 'siblings' is this note. Thus:

values(children,"Subtitle") 

will return all the discrete subtitles (i.e. values of $Subtitle) for children of this note, i.e. the note in which context the action is being evaluated.

If no first parameter is supplied, as in the short form above, the default group is assumed as 'all' and thus at whole document scope.