filter operators on dictionary contents

140 views
Skip to first unread message

Alex

unread,
Jan 29, 2019, 8:36:30 AM1/29/19
to TiddlyWiki
Hi,

Recently, I had to find dictionary tiddlers that have property validateAll: true.  The only thing I was able to come up with was the awkward snippet like below (yes, I know that prefix[true] is not the exact match for true):

<$list filter="[type[application/x-tiddler-dictionary]]" variable=xxx>
  <$list filter="[
<xxx>getindex[validateAll]prefix[true]]" >
  <
<xxx>>
  </$list>
 
<br/>
</$list>

Is there a more elegant way of doing this, preferably purely through filter expression? It would be nice to have something like [field:##validateAll[true]], or a special operator dedicated to dictionaries...

S. S.

unread,
Jan 30, 2019, 1:38:46 AM1/30/19
to TiddlyWiki

Alex,

I don't know if this is the best way to do it, but I believe it should work until someone posts a more elegant solution.

<$list filter="[type[application/x-tiddler-dictionary]]" variable=dataTid>
    <$list filter="[
<dataTid>getindex[validateAll]]">
        <$reveal type="match" text="true" stateTitle=<
<dataTid>> stateIndex="validateAll">
            <
<dataTid>>
        </$reveal>
    </$list>
   
<br/>
</$list>

Regards

S. S.

unread,
Jan 30, 2019, 7:25:27 AM1/30/19
to TiddlyWiki

I found this issue intriguing, and remembered Thomas Elmiger's Compare if-then-else Style in Wikitext

So this should also work - meaning it finds and lists Data Tiddlers that:
  • have an index named:  validateAll
  • that has its data: true
  • and as a bonus, it makes a link to the tiddlers

\define make-link() <$link to="$(display)$">$(display)$</$link><br>


<$list filter="[type[application/x-tiddler-dictionary]]" variable=dataTid>
<$set name="display" value=<<dataTid>>>
<$set name="data" tiddler=<<dataTid>> index="validateAll">
<$list filter="[<data>] -[[true]]" emptyMessage=<<make-link>>>
</
$list>
</$set>
</
$set>
</$list>



TonyM

unread,
Jan 30, 2019, 7:48:27 PM1/30/19
to TiddlyWiki
Nice ss

Make link is worth being a global macro.

Thanks for sharing

Tony

Mohammad

unread,
Feb 8, 2019, 12:13:50 AM2/8/19
to TiddlyWiki
Added to TW-Scripts.
Reply all
Reply to author
Forward
0 new messages