EDIT: This is a post where my own bad habit got in the way of remembering things that I used to know.
Read only if you want to entertain yourself. Otherwise skip to response by @saqimtiaz
In thinking through the puzzle thread, I realize that I wish I understood an easier way to get a simple filter run ā starting from a title list ā to filter out (or filter in, whatever) exactly those tiddlers where field X matches (or doesnāt match) field Y. The [get[fieldname]]
step works conveniently enough for just one field at a timeā¦ Of course we can work with variables, or nested lists, to get more āelbow roomā for complex operations. But it seems like it should be intuitively easy to make a filter syntax that just handily compares one field against another. No?
In fact, I was able to construct a single long filter to do this (starting with title list and returning only the titles, or variants thereof, where key
field fails to match text
field), but it was terribly roundabout!
Boring details: Beginning with the title list, I used :map
to tack one field value onto the end of the title string, then used :map
again to backtrack to the title to retrieve the second field value to tack onto the end of the compound title stringā¦(!) At that point the filter is carrying a string for each tiddler from the initial title list, modified to tack on suffixes for each of the field valuesā¦ At which point a split-join-enlist combo can extract just the two field-values from the end of each string, and use a :filter
-prefix run to evaluate (again for each of the initial titles in title-list) to keep only the strings with a discrepancy. Surely thereās a better way?
Below is the gist of the single ā LONG! ā filter that accomplishes what I thought should be a simple task (testing whether there are any tiddlers, from the initial title list, where the two fields donāt match). Does TiddlyWiki have a better way of doing this within a single filter? (If not, could it be a worthy tweak?)
:[ā¦initial filtered title list hereā¦]
:map[<currentTiddler>get[key]addprefix[ā]addprefix<currentTiddler>] :map[<currentTiddler>split[ā]first[]join[]get[text]addprefix[ā]addprefix<currentTiddler>] :filter[<currentTiddler>split[ā]last[2]join[ ]enlist-input[]count[]compare:integer:eq[2]]" emptyMessage="SOLVED!"/>