Need a filter for tiddlers based on more than one criteria

I need to show a custom viewtemplate on tiddlers based on more than one criteria .
I need the custom viewtemplate to be shown on all of the tiddlers with below given combination of fields - fieldname-A:fieldvalue-A, fieldname-A:fieldvalue-B, fieldname-A:fieldvalue-C
How to do it ?

<$list filter="[all[current]fieldname-A[fieldvalue-A]]">

I know the filter to show the viewtemplate on tiddlers with fields fieldname-A:fieldvalue-A . How to add the rest of the field combinations also to the filter ?.

Your filter to catch any of those 3 values in fieldnameA can look like this:

{{{ [[fieldvalue-A]] [[fieldvalue-B]] [[fieldvalue-C]] +[listed[fieldname-A]] }}}

Of course, the “listed” approach will pull tiddlers that include any of those values, whether or not the field also contains other values. For most use cases I can imagine, that’s what I want, and I specifically would not want my filter to exclude tiddlers that have additional values in the field. Is this assumption ok for your use-case?

https://task-demo.tiddlyhost.com/#%24%3A%2FTasker%2FKanban%2FViewTemplate%2FKanbanTagging

This is the filter I am using. I want the kanban viewtemplate to be shown in tiddlers with fields like gsd_type:project, gsd_type:realm, gsd_type:contact
But with the current filter kanban viewtemplate is shown on all tiddlers in the storylist.

What other values can the field you are testing have?
Perhaps you could state the logic seperate from the code?

I find it easier to stack a series of negative tests

[get[gsd_type]!match[avalue]!match[bvalue]] and if you want the opposite you can use emptyMessage.

We now have realy easy ways using the new functions definition so if you spell out the logic I can give you a solution. Here is a guess;

\function kanban.test() [{!!gsd_type}match[project]]  [{!!gsd_type}match[realm]] [{!!gsd_type}match[contact]]
  • something to note here is using {!!fieldname} refers to the field on the current tiddler.

Now if you use <<kanban.test>> as a filter the first and only value will be true and if none are true the filter does not return anything.

1 Like

Here’s a way with regular expressions:

<$reveal tag="div" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
<$list filter="[all[current]regexp:gsd_type[(realm|project|contact)]]">
{{!!lien}}
{{||$:/Tasker/Kanban/Tagging}}
</$list>
</$reveal>

The problem with the “listed” approach is that listed looks at all tiddlers for a match – not just the current tiddler.

Edit 3: Here’s a version that works in almost the same manner as your original intent:

<$reveal tag="div" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
<$list filter="[[project]] [[realm]] [[contact]] :filter[<..currentTiddler>get[gsd_type]match<currentTiddler>]">
{{!!lien}}
{{||$:/Tasker/Kanban/Tagging}}
</$list>
</$reveal>
1 Like

@TW_Tones @Mark_S Thank you both of you for the solutions.

I will use the regexp approach by @Mark_S for the time being because there is some issue with the other two solutions and kanban. Although the kanban viewtemplate is correctly displayed, I am unable to add task into the kanban with the other two solutions provided. But regexp approach doesn’t have this problem. I don’t know why its is happening like that. I will investigate.

Oh. Needs variable=“null” .

1 Like

Everything works now. Thank you @Mark_S for the help. Which one of the above three solutions should I use. Any suggestions ?
@TW_Tones solutions will help me to understand about functions and use them in my wiki more.