The filter function in TW is essential, but not always easy to master.
I have this filter used in a table-dynamic macro in my tiddler
[field:year[2008]sort[title]]
and it work fine.
My question is how to replace in this filter the value ‘2008’ by the content of my tiddler year field ?
I tried [field:year[{{!!year}}]sort[title]]
but it does not work… I guess there is a filter twist to achieve this …
Try this:
[field:year{!!year}sort[title]]
Notes:
- The brackets used in filter syntax are not just delimiters. They also indicate what kind of syntax is enclosed.
- Use square brackets for literal values, e.g.
[2008]
- Use curly braces for tiddler field/index references, e.g.
{!!year}, {##year}, {TiddlerName}
- Use angle brackets for variable name references, e.g.
<year>
- Use square brackets for literal values, e.g.
- Also take note that, unlike brackets used directly in wikitext which are doubled (e.g.,
[[TiddlerName]], {{!!fieldname}}, {{##indexname}}, <<variablename>>
), brackets in filter syntax are not doubled.
enjoy,
-e
2 Likes
Unfortunately most of the tiddlywiki.com examples use literals and not fields and variables. This has being disappointing for me because literals are only useful for simple or ad hoc solutions not common solutions.
@EricShulman always explains it so nicely.
Thank you very much. This does the job so well.
It’s a kind of magic when the filter does exactly what you expect !