Filter efficiency question

160 views
Skip to first unread message

Dave

unread,
Oct 22, 2018, 2:29:39 AM10/22/18
to TiddlyWiki
Hi, I have a filter that works in a ViewTemplate, but it seems cumbersome

<$list filter="[all[current]!title[FrontPage]tag[errands]][all[current]!title[FrontPage]tag[work]]">
(Button to check as done)
</$list>


I want to have something appear if tagged with a list of any of a bunch of tiddlers (about 7 or 8, so this will get big) but not if it's certain other tiddlers (so far just FrontPage)

Is there a better way of filtering "tiddlers tagged from this list of tiddlers, but not if among this other list of tiddlers"?

Thanks,
- Dave

TonyM

unread,
Oct 22, 2018, 7:44:09 AM10/22/18
to TiddlyWiki
Dave,

Any reason you cant create a new tag or two to tag other bunches. Then filter with these bunch tags?

In most cases I think the most efficient are the easiest to read because we spend more time changing them than running them.

Regards
Tony

Jed Carty

unread,
Oct 22, 2018, 10:10:00 AM10/22/18
to TiddlyWiki
I am looking at making an intersects operator similar to the contains operator that lets you give a list of values instead and returns the tiddler if any values from the argument match any in the field of the input tiddler.

But since that doesn't exist yet you can use de morgan's law:

A or B or C ... => !A and !B and !C ...

so you can make your filter:

[all[current]!title[FrontPage]]-[!tag[work]!tag[errands]]

and if you add more tags you continue the second part like this:

[all[current]!title[FrontPage]]-[!tag[work]!tag[errands]!tag[foo]!tag[bar]]

I made a wiki that has some examples of how to translate logic statement to filters that may help a bit.

Jed Carty

unread,
Oct 22, 2018, 10:19:59 AM10/22/18
to TiddlyWiki
Sorry, I didn't actually add the link to the wiki, here it is: https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/

Dave

unread,
Oct 22, 2018, 2:00:52 PM10/22/18
to TiddlyWiki
Thanks, but when I plug that in to the above filter (replacing the former) it doesn't work (nothing is returned)

Jed Carty

unread,
Oct 22, 2018, 2:06:20 PM10/22/18
to TiddlyWiki
This works on tiddlywiki.com:

make a tiddler and give it the tag $:/tags/ViewTemplate

put this into the text field:

<$list filter='[is[current]!title[FrontPage]]-[!tag[work]!tag[errand]]'>
LOOK AT ME!!
</$list>

then tag a tiddler 'work' or 'errand' and it should get the text 'LOOK AT ME!!' added to it.

Mohammad

unread,
Oct 22, 2018, 2:15:17 PM10/22/18
to TiddlyWiki
Great job Jed!  It shows how we can make complicated logical expression (filters).
Thank you

Mohammad

unread,
Oct 22, 2018, 2:23:46 PM10/22/18
to TiddlyWiki
Jed,
 Why you have used such old tiddlywiki? I expected at least 5.1.17

-Mohammad


On Monday, October 22, 2018 at 5:49:59 PM UTC+3:30, Jed Carty wrote:

Jed Carty

unread,
Oct 22, 2018, 2:30:16 PM10/22/18
to TiddlyWiki
It was the most recent version when I made it.

Mohammad

unread,
Oct 22, 2018, 3:13:22 PM10/22/18
to TiddlyWiki
Thanks Jed

Dave

unread,
Oct 23, 2018, 11:30:37 AM10/23/18
to TiddlyWiki
Thanks Jed. I'm not sure what I was doing wrong before, but it's working now. I think I seem to be having problems working with text on a phone vs with a mouse.
Reply all
Reply to author
Forward
0 new messages