From e6175227b229b8db1374b824da9dfa207d748c28 Mon Sep 17 00:00:00 2001 From: yaisog Date: Fri, 10 Mar 2023 16:57:51 +0100 Subject: [PATCH] Add another example for the `get` operator (#7351) --- editions/tw5.com/tiddlers/filters/examples/get.tid | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/editions/tw5.com/tiddlers/filters/examples/get.tid b/editions/tw5.com/tiddlers/filters/examples/get.tid index de56361cf..87655d0cb 100644 --- a/editions/tw5.com/tiddlers/filters/examples/get.tid +++ b/editions/tw5.com/tiddlers/filters/examples/get.tid @@ -1,5 +1,5 @@ created: 20150118134611000 -modified: 20230309180521925 +modified: 20230310154010278 myfield: tags: [[get Operator]] [[Operator Examples]] title: get Operator (Examples) @@ -16,4 +16,7 @@ type: text/vnd.tiddlywiki <<.operator-example 4 "[all[current]get[myfield]]" "the empty value of field <<.field myfield>> is not returned by the <<.olink get>> operator">> <<.operator-example 5 "[all[current]] :filter[has:field[myfield]] :map[get[myfield]]" "also returns the empty string">> -The above example works by first using the [[Filter Filter Run Prefix]] to only select titles that have the field <<.field myfield>> and then using the [[Map Filter Run Prefix]] to replace those titles with their value of that field. The [[Map Filter Run Prefix]] outputs an empty string when its filter run returns an empty [[selection|Title Selection]]. \ No newline at end of file +The above example works by first using the [[Filter Filter Run Prefix]] to only select titles that have the field <<.field myfield>> and then using the [[Map Filter Run Prefix]] to replace those titles with their value of that field. The [[Map Filter Run Prefix]] outputs an empty string when its filter run returns an empty [[selection|Title Selection]]. + +<<.operator-example 6 "[all[tiddlers]] :filter[get[created]compare:date:lt{HelloThere!!created}]" "return all tiddlers that are older than [[HelloThere]]">> +The above example demonstrates two different ways of accessing field values in filters: Use <<.olink get>> when the title is not known in advance as with the [[Filter Filter Run Prefix]] where <<.var currentTiddler>> is set to the current input title. Use a [[TextReference]] as an indirect [[Filter Parameter]] when the title is known.