current DataTiddler ???

80 views
Skip to first unread message

Jean-Pierre Rivière

unread,
Sep 23, 2020, 4:59:09 AM9/23/20
to TiddlyWiki
In the "Transclusion in WikiText" doc, it's wriiten:

{{##index}} transcludes a specified indexed property of the current DataTiddler

A data tiddler of that kind is a collection of "key:value" lines or a json text to the same purpose.

So, how could a data tiddler use {{##index}} ? I think it cannot (or that would be weird)

Then, since the ##index transclusion method cannot/shouldn't be used within a data tiddler, the very notion of "current data tiddler" seems completely out of order. So either {{##index}} should be forbidden or the explication state that it's of no use or... state how one could set a current data tiddler within a regular tiddler/macro tiddler!

Best regards,

Eric Shulman

unread,
Sep 23, 2020, 5:49:35 AM9/23/20
to TiddlyWiki
On Wednesday, September 23, 2020 at 1:59:09 AM UTC-7, Jean-Pierre Rivière wrote:
... how one could set a current data tiddler within a regular tiddler/macro tiddler!

There are several widgets that can be used to set the value of <<currentTiddler>>.  One of the most frequently used is the $list widget.

For example, suppose you have several data tiddlers, each tagged with "MyData" and containing an index named "purpose" and another index named "priority"
Then, to list the purpose and priority for each data tiddler, you could write something like this:
<$list filter="[tag[MyData]]">
   <$link /> was created on <$view field="modified"/> for {{##purpose}} with a priority of {{##priority}}
<br>
</$list>
or, you could create a template tiddler (e.g., "MyTemplate") containing:
<$link /> was created on <$view field="modified"/> for {{##purpose}} with a priority of {{##priority}}
and then invoke it via transclusion like this:
<$list filter="[tag[MyData]]"> {{||MyTemplate}} </$list>

Another example...
suppose you have just one data tiddler named "MyData", and you want to show several index values from that tiddler.  Then, you could use the $tiddler widget, like this:
<$tiddler tiddler="MyData">
   <$link /> was created on <$view field="modified"/> for {{##purpose}} with a priority of {{##priority}}
</$tiddler>
or with the same template as defined above:
{{MyData||MyTemplate}}

enjoy,
-e
Reply all
Reply to author
Forward
0 new messages