purpose | modify input titles by the result of evaluating this filter run for each item |
---|---|
input | the filter output of all previous runs so far |
suffix | Introduced in v5.2.3 flat to return all results from the filter run, or omit (default) to return only the first result |
output | the input titles as modified by the result of this filter run |
Each input title from previous runs is passed to this run in turn. The filter run transforms the input titles and the output of this run replaces the input title. For example, the filter run [get[caption]else{!!title}]
replaces each input title with its caption field, unless the field does not exist in which case the title is preserved.
Note that within the filter run, the currentTiddler
variable is set to the title of the tiddler being processed. This permits filter runs like :map[{!!price}multiply{!!cost}]
to be used for computation.
The following variables are available within the filter run:
currentTiddler
- the input title..currentTiddler
- the value of the variablecurrentTiddler
outside the filter run.index
- Introduced in v5.2.1 the numeric index of the current list item (with zero being the first item in the list).revIndex
- Introduced in v5.2.1 the reverse numeric index of the current list item (with zero being the last item in the list).length
- Introduced in v5.2.1 the total length of the input list.
Filter runs used with the :map
prefix should return at least the same number of items that they are passed. Input titles for which the filter run returns no output are replaced by an empty string. In particular, when retrieving the value of a field with the get Operator it is helpful to guard against a missing field value using the else Operator. For example [get[myfield]else[default-value]...
.