TiddlyWiki5/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix.tid

33 lines
2.1 KiB
Plaintext
Raw Normal View History

created: 20210618133745003
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
from-version: 5.2.0
2024-03-12 20:54:45 +00:00
modified: 20240312202834547
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
rp-input: the filter output of all previous runs so far
rp-output: the input titles as modified by the result of this filter run
rp-purpose: modify input titles by the result of evaluating this filter run for each item
rp-suffix: <<.from-version "5.2.3">> <<.value flat>> to return all results from the filter run, or omit (default) to return only the first result
tags: [[Named Filter Run Prefix]]
title: Map Filter Run Prefix
type: text/vnd.tiddlywiki
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
<$railroad text="""
\start none
\end none
2024-03-12 20:54:45 +00:00
( ":map" (: ":flat" | - ) | - )
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
[[run|"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.
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
Note that within the filter run, the <<.var 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:
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
* <<.var currentTiddler>> - the input title
* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run.
* <<.var index>> - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list).
* <<.var revIndex>> - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list).
* <<.var length>> - <<.from-version "5.2.1">> the total length of the input list.
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
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]...`.
Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog <m@rcuswinter.de> * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog <m@rcuswinter.de>
2024-02-14 16:20:32 +00:00
[[Map Filter Run Prefix (Examples)]]