How do I pass data to a list?

73 views
Skip to first unread message

Mike Andyl

unread,
Jul 3, 2021, 8:27:37 PM7/3/21
to TiddlyWiki
I want to select a tag, and pass its name to the button for processing.
I use a field for this.

<$select field="target" default='(none)'>
<option value="null">(none)</option>
<$list filter="[all[tiddlers]tags[]sort[title]]">
<option value=<<currentTiddler>>><$view field="title"/></option>
</$list>
</$select>

<$button>
open filtered tiddlers [tag[{{!!target}}]]
<$list filter="[tag[{{!!target}}]]">
<$action-navigate $to={{!!title}}/>
<$action-sendmessage $message="tm-unfold-all-tiddlers"/>
</$list>
</$button>

But on the button, the field doesn't work. As if it were empty.
<$list filter="[tag[{{!!target}}]]">

If I write with my hands, then everything works.
<$list filter="[tag[About]]">
And on the button I see the correct name.

How to solve this problem correctly?

Eric Shulman

unread,
Jul 3, 2021, 9:08:08 PM7/3/21
to TiddlyWiki
On Saturday, July 3, 2021 at 5:27:37 PM UTC-7 miket...@gmail.com wrote:
<$list filter="[tag[{{!!target}}]]">

In filter syntax, square brackets surrounding the operand indicate that the operand is a literal text value.
When using a field reference, omit the square brackets and use single curly braces instead.
When using a variable reference, omit the square brackets and use single angle brackets instead.

Thus:
[tag[literaltext]]
[tag{!!fieldname}]
[tag<variablename>]

So, for the example code you provided, you would write:
<$list filter="[tag{!!target}]">

enjoy,
-e

Mike Andyl

unread,
Jul 4, 2021, 5:21:23 AM7/4/21
to TiddlyWiki
many thanks! Everything is working.

For fun.
[tag<variablename>]
Tell me pls, how to set the variable correctly in this case?

воскресенье, 4 июля 2021 г. в 04:08:08 UTC+3, Eric Shulman:
Reply all
Reply to author
Forward
0 new messages