Filter to return tiddlers that do not contain any members of a given list

47 views
Skip to first unread message

Si

unread,
Jul 10, 2021, 10:47:58 AM7/10/21
to TiddlyWiki
Best explained with an example:

I have a bunch of tiddlers tagged Flashcard, each with a field identifier containing some text.

I want to return all the tiddlers that do not feature the values of any identifier fields within their text.

Initially I tried the following:

<$list filter="[tag[Flashcard]get[identifier]]" variable=flashcardIdentifier>
    <$list filter="[!search<flashcardIndicator>]">
        <<currentTiddler>>
    </$list>
</$list>

Of course this doesn't work because it is applying the search one at a time and is thus returning the tiddlers that don't contain all the identifiers. I want to return the tiddlers that don't contain any identifiers.

Anyway now I'm stuck, so I'm wondering if anyone can help me out?

Saq Imtiaz

unread,
Jul 10, 2021, 11:11:09 AM7/10/21
to TiddlyWiki
Assuming your identifiers are alphanumeric and do not contain characters that might need to be escaped in regular expressions, something like this should work:

<$vars idListRegexp="[tag[Flashcard]get[identifier]join[|]]">
<$list filter="[all[tiddlers]!regexp<idListRegexp>]">
<<currentTiddler>>
</$list>
</$vars>

Si

unread,
Jul 10, 2021, 12:03:40 PM7/10/21
to TiddlyWiki
Thank you very much Saq! (I assume you meant to put idListRegexp in curly braces?)

I have kind of a follow up question:

What if instead of using search terms as identifiers, I instead used filters. So for example I might have a tiddler with identifier:[search[my-example]] or identifier:[tag[Hello]].

Then I would want to return all tiddlers that don't satisfy any of the filters listed in an identifier field. Is there a way to do this?
Reply all
Reply to author
Forward
0 new messages