Complex Filter Question

70 views
Skip to first unread message

Stephen Kimmel

unread,
Apr 7, 2017, 10:00:14 AM4/7/17
to TiddlyWiki
This seems like this ought to be easy but, so far, it has beaten me.

I have a group of tiddlers that are tagged as "A" or "B" and are also tagged with one or more of "1", "2", "3" or "4". Depending on a group of checkboxes, I want a list with created using a filter that is the equivalent of

((tag[A] or tag[B]) and (tag[1] or tag[2] or tag[3] or tag[4])).

To be displayed in the list, the tiddler must have one of the A or B tags and at least one of the 1,2,3 or 4 tags. So far, everything I've tried gives me either gives me nothing at all or far too much. Can someone tell me how to structure that filter?

Mark S.

unread,
Apr 7, 2017, 6:22:45 PM4/7/17
to TiddlyWiki
Since there's no grouping in filters, I'm thinking you use the commutative principle and put them together as a series of runs ...

[tag[A]tag[1]] [tag[A]tag[2]] [tag[A]tag[3]] ...etc. ... [tag[B]tag[3]] [tag[B]tag[4]]

Mark

Jed Carty

unread,
Apr 7, 2017, 11:38:25 PM4/7/17
to TiddlyWiki
somewhere I wrote a guide to translating boolean algebra into filters but I can't find the link now.

De Morgan's law generally saves the day!

((tag[A] or tag[B]) and (tag[1] or tag[2] or tag[3] or tag[4])) <=> !(!tag[A] and !tag[b]) or !(tag[1] and tag[2] and tag[3] and tag[4])

which in filter language translates to:

[all[]]-[!tag[A]!tag[B]]-[!tag[1]!tag[2]!tag[3]!tag[4]]

digital logic can be magic

Jed Carty

unread,
Apr 7, 2017, 11:40:49 PM4/7/17
to TiddlyWiki
There are some typos in the logic part of that. It should say:

((tag[A] or tag[B]) and (tag[1] or tag[2] or tag[3] or tag[4])) <=> !(!tag[A] and !tag[b]) or !(!tag[1] and !tag[2] and !tag[3] and !tag[4])

but the filter in that last bit is correct and works on tiddlywiki.com
Reply all
Reply to author
Forward
0 new messages