On Tuesday, May 24, 2022 at 4:36:35 AM UTC-7 David wrote:
> ```
> <$list
> filter="[<currentTiddler>indexes[]search:title:literal[Vegas]sort[]]"
> variable=item>
> ```
> But it seems your code snippet is not working with the variable/field in
> there. It works fine when I put some static text there, though, as seen in
> my line above.
>
The problem is due to the surrounding `<$tiddler tiddler="Dictionary
Tiddler">... </$tiddler>` widget.
Because of this, the reference to `{!!searchText}` is looking in
"Dictionary Tiddler" for the field contents.
One way around this is to remove the `$tiddler` widget and hard-code the
"Dictionary Tiddler" title, like this:
```
<$list filter="[[Dictionary
Tiddler]indexes[]search:title:literal{!!searchText}sort[]]" variable=item>
<$checkbox tiddler="Dictionary Tiddler" index=<<item>> checked="1"
unchecked="0"/>
<<item>><br/>
</$list>
```
This allows the `{!!searchText}` reference to point to a field in the
tiddler containing the `<$list>` widget, rather than the "Dictionary
Tiddler" itself.
However... if the intention is to eventually enable lookups using different
Dictionary Tiddlers, then the following code may be more useful:
```
<$edit-text field="searchText"/>
<$select field="dictionary">
<option>Dictionary Tiddler</option>
<option>Another Dictionary</option>
<option>Some Other Dictionary</option>
<option>etc...</option>
</$select>
<br>
<$let searchText={{!!searchText}}>
<$tiddler tiddler={{!!dictionary}}>
<$list
filter="[all[current]indexes[]search:title:literal<searchText>sort[]]"
variable=item>
<$checkbox index=<<item>> checked="1" unchecked="0"/>
<<item>><br/>
</$list>
</$tiddler>
</$let>
```
Basically, this sets a variable to the value of the searchText field before
using `$tiddler` to change the current tiddler,
and then uses the value of that variable in the filter syntax. It also
lets you select a dictionary tiddler title from a
droplist input, and then uses that title in the `$tiddler` widget, so that
the lookup points to another dictionary while
still using the searchText input from the current tiddler.
enjoy,
-e
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/f819aafb-7fc8-452a-ab9c-26b8ca5b7e29n%40googlegroups.com.