I’m starting my journey with tiddlywiki and playing with basics.
Let say I have these tiddlers:
-
Marvelous tiddler with field destination: [[New Mexico]]
-
Also a good one with field origin: [[New Mexico]]
-
Sleepwalker with field origin: [[New Mexico]]
Now, in tiddler New Mexico I can manage to find all tiddlers which reference it by any field with
{{{ [!is[system]search:-title{!!title}] }}} (although it doesn’t feel the right way) :
* Also a good one
* Marvelous tiddler
* Sleepwalker
But I can’t find a way to retrieve the field name corresponding for sorting:
* Destination: Sleepwalker
* Origin: Also a good one, Marvelous tiddler
Does someone can enlighten me ? Or tell me that I should do another way ?
Here’s a solution… (it’s not pretty… but it does achieve your stated objective)
<$set name=tids filter="[!is[system]search:-title<thisTiddler>]">
<$list filter="[enlist<tids>fields[]sort[]] :filter[enlist<tids>get<currentTiddler>search:title<thisTiddler>]" variable="field">
<li><$text text={{{ [<field>lowercase[]sentencecase[]] }}}/>:
<$list filter="[enlist<tids>] :filter[get<field>search:title<thisTiddler>]" counter=thistid>
<$link/><$text text={{{ [<thistid-last>!match[yes]then[, ]] }}}/>
</$list>
</li>
</$list>
</$set>
Notes:
-
thisTiddler is a TWCore variable that always refers to the tiddler in which the wikitext is defined
- Line 1: Find all tiddlers where any field (other than the title) contains a reference to thisTiddler
- Line 2: Get ALL fieldnames (sorted alphabetically) from found tiddlers and keep only those fields that actually contain a reference to thisTiddler. Then, for each matching fieldname:
- Line 3: Show a bullet and the current fieldname (with first-letter capitalization)
- Line 4: For each found tiddler in which the contents of the current fieldname references the current tiddler
- Line 5: Show a link to the found tiddler, followed by “comma space” if not the last item in the list
- Line 6-9: close all the widgets
enjoy,
-e
As you said, it does the job but it’s not pretty !
Thank you for the trick about thisTiddler
I’ll digest this and maybe think about a smarter pattern.