[TW5] filter only when value=

57 views
Skip to first unread message

TonyM

unread,
Dec 18, 2017, 2:34:49 AM12/18/17
to TiddlyWiki
Folks,

I have being beating my head against a brick wall, for a few hours now, I know I am missing something basic.

Please consider the below macro

\define dateincrements(datefield,inc:"d w f m h q y")
dateincrements "$inc$"
<$list filter="$inc$" variable=period>
Each:<<period>><br>
<$list filter="THISFILTER" variable=day>
Action <<day>><br>
</$list>
</$list>
\end

I want a filter "THISFILTER", such that, for example
Action <<day>><br>
will only occur when <<period>> is = "d".

Thanks in Advance
Tony

Jed Carty

unread,
Dec 18, 2017, 6:18:27 AM12/18/17
to TiddlyWiki
I am not sure I understand what your example is saying, but I think you want to look at the reveal widget or you could try this:

\define dateincrements(datefield,inc:"d w f m h q y")
dateincrements "$inc$"
<$list filter="$inc$" variable=period>
Each:<<period>><br>
<$list filter="[<period>prefix[d]]" variable=day>
Action <<day>><br>
</$list>
</$list>
\end

There are some pull requests with competing implementations of filter operators that would solve this. I believe that the most mature plugin for this is by Tobias http://tobibeer.github.io/tw5-plugins/#contains. I made some filters that do similar things here (the plugin tiddler is here). If I remember correctly Tobias made (or is making) a plugin to do just equality but I am not sure what the link to that one is.

TonyM

unread,
Dec 18, 2017, 7:56:06 AM12/18/17
to TiddlyWiki
Jed,

Thanks, I will test it soon. The old prefix operator comming to the rescue once again when we want to compare a title to a literal in this case d.
Ta muchly
Tony

Reply all
Reply to author
Forward
0 new messages