It appears that the [{$:/state/table}] returns an invisible "something"
that the filter sees as "non-empty". This makes my solution rather
convoluted. For the 2nd part I came up with:
<$set filter="[{$:/state/table}addprefix[X]addsuffix[X]!prefix[XX]]
[title[XEMPTYX]] OTHER +[nth[1]removeprefix[X]removesuffix[X]]"
name="searchme" >
<$reveal state="$:/state/table!!selection" type="match" text="auctor">
<br><br>
<$set name="data" value="$:/_dictionary/auctor">
Searching for: ::<<searchme>>::<br/>
<$list filter="[<data>indexes[]prefix<searchme>sort[title]]">
;{{!!title}}
:<$transclude tiddler=<<data>> index=<<currentTiddler>>/>
</$list>
</$set>
</$reveal>
</$set>
Note that the set widget uses a filter to take the input field, append and
prepend "X", and then prevent the result if it matches "XX". If it doesn't
match, a title XEMPTYX is created, and then stripped of the X's to make
"EMPTY". Assuming that none of your indexes match "EMPTY", this should
work. Change X to something else if it's too common for you. Likewise the
word "EMPTY" if you want something even less likely to appear. I just
needed it to use clear text for my testing.
HTH
-- Mark
On Saturday, September 15, 2018 at 5:13:20 PM UTC-7, Magnus wrote:
>
> Hi, I'm trying to make a custom search from two data-tiddlers. I want to
> limit the search and only show the results that match the search field but
> can't make it work. Any help appreciated :)
> /Magnus
>
> <table>
> <tr>
> <td>Limit to: <$edit-text tiddler="$:/state/table" tag="input"
> default="" placeholder={{$:/language/Manager/Controls/Search/Placeholder}}/>
> </td>
> </tr>
> <tr>
> <td><$radio tiddler="$:/state/table" field="selection"
> value="abbreviations"> Abbreviations</$radio>
> <$radio tiddler="$:/state/table" field="selection" value="auctor">
> Auctor</$radio>
>
> <$reveal state="$:/state/table!!selection" type="match"
> text="abbreviations">
> <br><br>
> <table class="nolines">
> <$list filter="[[$:/_dictionary/abbreviation]]
> [[$:/_dictionary/pronunciation]] +[indexes[]]">
> <tr>
> <td><<currentTiddler>></td>
> <td><$view tiddler="$:/_dictionary/abbreviation"
> index=<<currentTiddler>>/></td>
> <td><$view tiddler="$:/_dictionary/pronunciation"
> index=<<currentTiddler>>/></td>
> </tr>
> </$list>
> </table>
> </$reveal>
> <$reveal state="$:/state/table!!selection" type="match" text="auctor">
> <br><br>
> <$set name="data" value="$:/_dictionary/auctor">
> <$list filter="[<data>indexes[]sort[title]]">
>
> ;{{!!title}}
> :<$transclude tiddler=<<data>> index=<<currentTiddler>>/>
> </$list>
> </$set>
> </$reveal>
> </td>
> </tr>
> </table>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/f530be72-134f-419d-ae88-8c41838ed81d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.