conditional filtering

94 views
Skip to first unread message

vpl

unread,
Jul 9, 2019, 3:27:45 AM7/9/19
to TiddlyWiki
Hi,

I would like to define a filter for listing values in a table which would be based on radio button value
I explain
I want to have 2 mode of selecting the filter criteria: 
   -  Either a $select which provides a list of preconfigured categories or
   -  <$edit-text tiddler="StdSearchInput" field="searchval"/> which allows entering a free text
then I would like to set a radio button to choose between these 2 options

My problem is that I don't know howw to position conditional filtering (based on the radio value) into the tiddlywiki filter expression ..

Any idea where I should start from ?

VIncent

TonyM

unread,
Jul 9, 2019, 3:42:44 AM7/9/19
to TiddlyWiki

Vincent,

See The https://tiddlywiki.com/#subfilter%20Operator and note how myFilter is defined in the set widget. Others include a filter from a tiddler
filter="{tiddlerwithfilter}" or the whoile filter filter={{tiddlerwithfilter}}

However you could use the select widget and one of those options is your tiddler="StdSearchInput" field="searchval" or {{StdSearchInput!!searchval}}

The select will modify its state tiddler/field lets say select-state

<$list filter="{select-state}">....

More details on request.

Regards
Tony

vpl

unread,
Jul 9, 2019, 5:18:59 PM7/9/19
to TiddlyWiki
Hi,

I've tried this direction but block ...

Here is where I am

I want to perform a list on either the Category of the free text

WHen I run the bolow code, even if I click on the different radio button the <<myFilter>> does not change ...

Any help ...
Regards


<$radio field="searchType" value="Categ">Category</$radio>
<$radio field="searchType" value="FreeT">Free Text</$radio>

<$select field="sortfield">
<option value="Standard-jazz">Standards Jazz</option>
<option value="Celtic">Celtic</option>
<option value="Chansons-Fr">Chansons Francais</option>
<option value="autres">Autres</option>
<option value="All">All</option>
</$select>

<$set name="myFilter" filter="[searchType[Categ]]" value="[search:tags{!!sortfield}sort[tags]]" emptyValue="[search:title{!!searchval}reverse[]]">
<$text text=<<myFilter>>/>
</$set>

TonyM

unread,
Jul 9, 2019, 6:50:15 PM7/9/19
to TiddlyWiki
Vincent,

In you set widget you have
filter="[searchType[Categ]]" value="[search:tags{!!sortfield}sort[tags]]"

This is incorrect because the result comes from either the filter OR the value. Once you correct that try again.

Regards
Tony

vpl

unread,
Jul 10, 2019, 3:17:49 AM7/10/19
to TiddlyWiki
Hi Tony

Thanks a lot for your answer
I'm not sure I follow you ... sorry
This is incorrect because the result comes from either the filter OR the value....

In my code I want to set myFilter  to a given filter depending on the radio selection
That why I try to filter this way 
filter="[searchType[Categ]]"
hopping that depending on the local field SearchType which should be = to Categ or FreeT depending on the radio choice I will have 
myFilter = "[search:tags{!!sortfield}sort[tags]]" OR
              ="[search:title{!!searchval}reverse[]]">

Then I apply the subfilter in the $list ..

Please explain me again what is wrong in this filter. I've tried also filter="[{{!!searchType}}[Categ]]" but same result ..

Thanks again for your help

Vpl


<$radio field="searchType" value="Categ">Category</$radio>
<$radio field="searchType" value="FreeT">Free Text</$radio>

<$select field="sortfield">
<option value="Standard-jazz">Standards Jazz</option>
<option value="Celtic">Celtic</option>
<option value="Chansons-Fr">Chansons Francais</option>
<option value="autres">Autres</option>
<option value="All">All</option>
</$select>

<$set name="myFilter" filter="[searchType[Categ]]" value="[search:tags{!!sortfield}sort[tags]]" emptyValue="[search:title{!!searchval}reverse[]]">
<$text text=<<myFilter>>/>
</$set>

<$list filter="[all[tiddlers]subfilter<myFilter>]">
........
Reply all
Reply to author
Forward
0 new messages