I need help with a filter - search story tiddlers

Hello all,

I have a configuration tiddler that can be set to yes
I want to create a filter that lists the <tv-story-list> and filters it ([list<tv-story-list>search[$:/temp/search/input]]) if that configuration tiddler is set to yes, otherwise the filter should only [list<tv-story-list>]

I don’t want to use a <%if ... else %> construct, it should all be done in a single filter but I cannot wrap my head around it

What I’ve come up with is:

<$list filter="[{$:/config/myconfig}match[yes]] :then[list<tv-story-list>search[$:/temp/search/input]] :else[list<tv-story-list>]"/>

… but that doesn’t work correctly.

I really appreciate any help from the community!
This filter would be used in the TiddlyFlex Layout to filter the story river(s) by the search input

Thank you all,
Simon

I came up with this filter and it seems to work:

[list<tv-story-list>] :filter[{$:/config/tiddlyflex/story-river/filter}match[yes]then<currentTiddler>search{$:/temp/search/input}else{$:/config/tiddlyflex/story-river/filter}!match[yes]then<currentTiddler>]

Simon,

I think you meant to search for the value in $:/temp/search/input

  • In the top post, search{$:/temp/search/input} not search[$:/temp/search/input]
<$list filter="[{$:/config/myconfig}match[yes]list<tv-story-list>search{$:/temp/search/input2}] :else[list<tv-story-list>]"/>
  • I also reduced the impact of draft tiddlers here;
<$list filter="[{$:/config/myconfig}match[yes]list<tv-story-list>!has[draft.of]search{$:/temp/search/input2}] :else[list<tv-story-list>!has[draft.of]]"/>