How to use variables in filter expressions

116 views
Skip to first unread message

Werner

unread,
Feb 20, 2019, 1:20:23 PM2/20/19
to TiddlyWiki
Hi, pretty new to TiddlyWiki and still trying to wrap my head around various concepts. Also did some searching in this group but haven't found anything that could help me.

OK, I want do some kind of dynamic filtering, according to a given variable. Basically, I want to set a variable and use it in a filter to reference the contents of a field. So, the result should look something like that

<<list-links "[field:blt[<currentBlt>]tag[Products]!field:status[1]]">>

where <currentBlt> would be the variable to be used.

Thanks for helping me out on this.

Best
Werner

TonyM

unread,
Feb 20, 2019, 5:42:48 PM2/20/19
to TiddlyWiki
Werner,

Just remove the [ ] from [<currentBlt>]

<<list-links "[field:blt<currentBlt>tag[Products]!field:status[1]]">>

I have a draft document covering this and more here http://tiddlywiki.psat.com.au/#Variables%2C%20Parameters%20and%20transclusions

See the within filters

  • There is no need to include html or widgets in Filters so single bracket versions are used (unlike Within wikiText)
In Wiki text we must allow <htmltag></htmltag> to be identified as they are different from <<macropname>>, <$widgetname></$widgetname> but not in filters.
so <variableormacro> and {tiddlername} or {tiddlername!!fielodname} are used in filters
  • since the above delineate the beginning and end of a variable or transclusion you leave out a set of [ ] in filters.
eg filter="[!has<fieldnamevar>]" or "filter="[<currentTiddler>backlinks[]]" "filter="[subfilter<subfilterdefinition>]"
While a variable's 'value', or a macros 'output', can be used as a filter parameter, 'macro parameters' are not supported in filters.
<macroname parameter> can be used but the parameter is ignored ????? TEST

Regards
Tony

Werner

unread,
Feb 21, 2019, 3:06:13 AM2/21/19
to TiddlyWiki
Thanks Tony, works. Still, what kind of string/variable concatenation works under what circumstances is pretty confusing. Bit of a learning curve actually.

Best
Werner

TonyM

unread,
Feb 21, 2019, 9:01:09 AM2/21/19
to TiddlyWiki
Hopefully that will get fully documented in the link I gave. Please contribute
Reply all
Reply to author
Forward
0 new messages