Dynamic Filters

136 views
Skip to first unread message

Stobot

unread,
Aug 26, 2017, 2:47:33 PM8/26/17
to TiddlyWiki
Hello all,

I'm stumped. I'm trying to dynamically build a list for project management. 

This *static* works:
<$list filter="[[A]] [[B]] [[E]] [[X]]">
...
</$list>
... which are project importance values

But I've added checkboxes with the intent of filtering some of those out. For instance if I uncheck 'A', then I want it to hide 'A'. The *static* way would either be 

<$list filter="[[B]] [[E]] [[X]]">
...
</$list>

or 

<$list filter="[[A]] [[B]] [[E]] [[X]] -[[A]]">
...
</$list>

and I'm just trying to 'assemble' this dynamically. The checkbox stores each of the values in fields of a temp tiddler (though not married to that)

<$checkbox tiddler="$:/temp/importancefilter" field="importance_a" checked="" unchecked="A">A</$checkbox> for A for example

After hours of reading other posts, it seems the answer must be some combination of macros, <$macrocall>, <$wikify>, <$set> - but I can't seem to get it right... I know this doesn't work:

\define testfilter()
[[{{$:/temp/importancefilter!!importance_a}}]] [[{{$:/temp/importancefilter!!importance_b}}]] [[{{$:/temp/importancefilter!!importance_e}}]] [[{{$:/temp/importancefilter!!importance_x}}]] 
\end

Funnily enough I can put [[A]] in the testfilter, and I can also use the {{}} in the testfilter, but not together...

It must be simple and I'm just not getting it.

Stobot

unread,
Aug 26, 2017, 3:31:48 PM8/26/17
to tiddl...@googlegroups.com
Think I figured it out. Will post in case someone else finds this...

\define projectfilterlist(a b e x) [[$(a)$]] [[$(b)$]] [[$(e)$]] [[$(x)$]] up at the top

Then down for the list:
<$vars a={{$:/temp/importancefilter!!importance_a}} b={{$:/temp/importancefilter!!importance_b}} e={{$:/temp/importancefilter!!importance_e}} x={{$:/temp/importancefilter!!importance_x}}>
<$list filter=<<projectfilterlist>>>
</$vars>

Mat

unread,
Aug 26, 2017, 6:36:15 PM8/26/17
to TiddlyWiki
Stobot,

without having investigated any specific details in your issue, my first attempt would be to use a separate field to store your filter (i.e the A B etc) and then use listops to manipulate the values in the field.

<:-)

Mark S.

unread,
Aug 26, 2017, 7:37:46 PM8/26/17
to TiddlyWiki
FYI, since you're passing everything by environmental variables, your macro doesn't need parameters. e.g.:

\define projectfilterlist() [[$(a)$]] [[$(b)$]] [[$(e)$]] [[$(x)$]] up at the top

Good luck,
Mark

Stephan Hradek

unread,
Aug 27, 2017, 2:27:39 PM8/27/17
to TiddlyWiki
What about putting your project importance values as tags to your tiddler which should filter?

Example which you can test on tiddlywiki.com:

<$list filter="[[Articles]] [[Contents]] [[Editions]]" variable="tag">

<$checkbox tag=<
<tag>>> <$text text=<<tag>>/></$checkbox>

</$list>

--

<$list filter="[
<currentTiddler>tags[]tagging[]] -[<currentTiddler>]"/>





[[Articles]] [[Contents]] [[Editions]] are the "importance values". If you check one (or more) those tiddlers having those tags will be displayed.

Stobot

unread,
Aug 29, 2017, 6:36:29 AM8/29/17
to TiddlyWiki
Thanks all. These help a lot and I'll try them all!
Reply all
Reply to author
Forward
0 new messages