Field as a parameter of aa filter

42 views
Skip to first unread message

Eduardo P. Klein

unread,
Jun 5, 2015, 10:31:22 AM6/5/15
to tiddl...@googlegroups.com
Hi all!

Very happy to use TiddlyWiki. I'm able to classify my information far better than in Evernote or OneNote.

I'm trying to filter a list based on the Tiddlers title, but not successful so far.

Here is my code snippet:

<$list filter="[tag[Book]tag[Napoleon Hill]sort[title]]">
  <$link to={{!!title}}><$view field="title"/></$link>
  * Library: <$view field="library"/>
</$list>

I tried tag[{{!!title}}] but that didn't work. Is there a way to insert the title as a parameter of my filter?


And if possible, is there a way also to reuse this snippet in many tiddlers, without copying and pasting?

Jed Carty

unread,
Jun 5, 2015, 10:59:49 AM6/5/15
to tiddl...@googlegroups.com
The quick answer is you use tag{!!title} instead. And for reusing it you want to use a macro.

To make the macro make a new tiddler and give it whatever name you want, then put this as the text of the tiddler:

\define someUsefulMacroName()
<$list filter="[tag[Book]tag{!!title}sort[title]]">

  <$link to={{!!title}}><$view field="title"/></$link>
  * Library: <$view field="library"/>
</$list>
\end

and tag the tiddler with $:/tags/Macro

Then anywhere you put <<someUsefulMacroName>> will display the same thing as if you had put all of the code there.

It is more advanced, but you can have this happen automatically in certain tiddlers using conditional view templates described here: https://tobibeer.github.io/tb5/#Conditional%20ViewTemplate%20Section

Some more about using fields and variables:

https://tobibeer.github.io/tb5/#Variables%20vs.%20Parameters

More about macros:

http://tiddlywiki.com/#Macros
http://inmysocks.tiddlyspot.com/#How%20to%20make%20macros

Eduardo P. Klein

unread,
Jun 5, 2015, 11:16:00 AM6/5/15
to tiddl...@googlegroups.com
Wow Jed!

Thanks for the prompt response, that's exactly what I needed!

I'm certainly going deeper in the references you posted. I'm sure it is going to make things even easier for me!

Cheers!
Eduardo
Reply all
Reply to author
Forward
0 new messages