Return tiddlers with matching field value

52 views
Skip to first unread message

Steven Schneider

unread,
Apr 17, 2020, 11:59:44 PM4/17/20
to TiddlyWiki
How do I get a list of tiddlers with a field that has a specified value.

I have TiddlerA with tag "howdy" with field "special" with value "Yes"

I do:

<$vars tagName="howdy" fieldName="special" fieldValue="Yes">

<$list filter="[tag<tagName>]"> works, but I can't figure out how to put <fieldName> and then <fieldValue> into the filter.

Thanks!

//steve.

Message has been deleted

Eric Shulman

unread,
Apr 18, 2020, 12:52:47 AM4/18/20
to TiddlyWiki
On Friday, April 17, 2020 at 8:59:44 PM UTC-7, Steven Schneider wrote:
How do I get a list of tiddlers with a field that has a specified value.
I have TiddlerA with tag "howdy" with field "special" with value "Yes"

You can use two nested $list widgets, like this:
<$vars tagName="howdy" fieldName="special" fieldValue="Yes">
<$list filter="[tag<tagName>has<fieldName>]">
   <$list filter="[
<currentTiddler>get<fieldName>match<fieldValue>]" variable="is_match">
       <
<currentTiddler>>
   </$list>
</$list>
</$vars>

The outer $list widget finds all tiddlers tagged with <<tagName>> that have a field named <<fieldName>>.
The inner $list widget tests each tiddler to see if the value of the fieldName matches the <<fieldValue>>.
Then, for each tiddler with a matching value, it does something (in the above example, it just displays the name of the tiddler)

enjoy,
-e



TonyM

unread,
Apr 18, 2020, 1:04:31 AM4/18/20
to TiddlyWiki
Eric,

this is no doubt the way I would do it, but I had a thought, Something like this should work in a single list;

[tag<tagName><fieldName><fieldValue>]

Or 

[tag[howdy]special[Yes]]

What do you think?

Tony
Reply all
Reply to author
Forward
0 new messages