Filter to look for a string inside a tiddler field?

84 views
Skip to first unread message

Beckstrom

unread,
Mar 8, 2020, 12:34:08 PM3/8/20
to TiddlyWiki
I’m creating some fishing-related tiddlers. For instance, a tiddler called “Big Lake” has a field called “point” that has a lat/long, and another field called “fish” whose value is a comma-separated list of fish that live in that lake

I can easily get a list of tiddlers that have the “fish” field:

<$list filter="[has[fish]]">
<<currentTiddler>>
{{!!fish}}
<br>
</$list>

I’d like to be able to create a list of places where a specific fish lives. some pseudo-code:

[has[fish]and[fish[contains:goldfish]]]

which would show a list of tiddlers where they have the field “fish” and that field value contains the string “goldfish”

Is this possible?

Mat

unread,
Mar 8, 2020, 12:42:45 PM3/8/20
to TiddlyWiki
I think this filter should work

[all[tiddlers]search:fish[goldfish]]

<:-)

Beckstrom

unread,
Mar 8, 2020, 1:14:39 PM3/8/20
to TiddlyWiki
yup that does the trick. thanks so much!

Beckstrom

unread,
Mar 8, 2020, 1:43:04 PM3/8/20
to TiddlyWiki
Ah, so close...

This works great:
<<list-links filter:"[all[tiddlers]search:fish[bluegill]]">>

Now I'm trying to grab the title of a tiddler and insert it into that filter (eg the tiddler is named "bluegill" and I want the filter to show me every tiddler that has the field "fish" that contains the word "bluegill"

I've tried:

<<list-links filter:"[all[tiddlers]search:fish[{{!!title}}]]">>

<<list-links filter:"[all[tiddlers]search:fish[<<currentTiddler>>]]">>

<<list-links filter:"[all[tiddlers]search:fish[<currentTiddler>]]">>

and various attempts with <$var> and <$set> (I don't really understand those yet)

Any ideas? thanks!

Mat

unread,
Mar 8, 2020, 2:14:02 PM3/8/20
to TiddlyWiki
Hehe. Yeah, not totally easy to learn the syntax but it'll come:

<<list-links filter:"[all[tiddlers]search:fish{!!title}]">>

I think one aim was to make filters syntactically pretty so brackets of various kinds are scaled down to a minimum inside filters.

<:-)

Beckstrom

unread,
Mar 8, 2020, 3:56:49 PM3/8/20
to TiddlyWiki
Whoohoo, awesome! Thanks for your Tiddlywiki magic. Eventually I get the hang of all the brackets!

TonyM

unread,
Mar 8, 2020, 11:10:06 PM3/8/20
to TiddlyWiki
Mat,

The reason for single <> in filters is apparently from a reverse position. In Wiki text we use <<macro to differentiate from <html tags, this is not required inside filters so we only use single <

I believe {!!fieldname} was for consistency.

Regards
Tony

David Allen

unread,
Mar 8, 2020, 11:51:22 PM3/8/20
to tiddl...@googlegroups.com
I'm not sure about putting it into list-links, but a filter along these lines should work:

filter="[[bluegill]listed[fish]]"

EDIT: If it's a comma-separated list, do the following:

filter="[[bluegill]append[,]listed[fish]]"
Reply all
Reply to author
Forward
0 new messages