how not to run same filter twice ??

30 views
Skip to first unread message

Tony K

unread,
May 22, 2020, 3:28:38 AM5/22/20
to TiddlyWiki
A follow up question to the one I just asked also about filters

I have this filter

[regexp:title<pattern>] [regexp:text<pattern>] -[all[current]backlinks[]] -[is[current]] -[tag[hide]] -[is[system]]

until now I am running it 3 times

1. to set a variable true/false 

        isFreelink = {{{ [regexp:title<pattern>] [regexp:text<pattern>] -[all[current]backlinks[]] -[is[current]] -[tag[hide]] -[is[system]] +[then[true]else[false]] }}}

2. as a counter

<$count filter= [regexp:title<pattern>] [regexp:text<pattern>] -[all[current]backlinks[]] -[is[current]] -[tag[hide]] -[is[system]]

3. to get the actual list

<$list filter=[regexp:title<pattern>] [regexp:text<pattern>] -[all[current]backlinks[]] -[is[current]] -[tag[hide]] -[is[system]]

is there a way to run it only once and then evaluate the other 2 from the list already saved?

thank you 

Saq Imtiaz

unread,
May 22, 2020, 3:37:22 AM5/22/20
to TiddlyWiki
You can but most of the time savings are neglibile. If in doubt, turn on performance profiling to see how long each filter takes to execute.
Otherwise you can do something like this, watch out for syntax errors since this is written on my tablet:

<$set name="_list" filter="""[regexp:title<pattern>] [regexp:text<pattern>] -[all[current]backlinks[]] -[is[current]] -[tag[hide]] -[is[system]]""">
<$set name="_listcount" filter="""[enlist<_list>]count[]]""">
<$set name="isFreelink" filter="""[enlist<_list>] +[then[true]else[false]]""">

<$list filter="""[enlist<_list>]""">

</$list>

</$set>
</$set>
</$set>

You can compress the 2nd and 3rd set widget into one vars widget.

Tony K

unread,
May 22, 2020, 3:45:35 AM5/22/20
to TiddlyWiki
Thank you Saq, thank you thank you thank you 
Reply all
Reply to author
Forward
0 new messages