FIlter by Criteria question

Hi ,
I am using a task manager, where tiddlers are tasks, and all have a field called Status , for which it can hold values such as In progress or completed

I am trying to use a select widget to toggle between different filter criteria , the select widget sets a value in a field, then i use the set widge to define the field value as a variable , then i take that variable and use in my filter,

Filter By <$select  tiddler=<<currentTiddler>>
field="statusfilter"…>
<option disabled></option>
<option>in progress</option>
<option>Completed</option>
</$select>
<$set name="statusfilter" value={{{[{!!statusfilter}]}}}>
<$list filter="  [status<statusfilter>tidtype[task]]">

this works to toggle between different values, but what if want all values, so a filter to show all statuses, is this acheivable using this method , or should i be trying something diffenret ?

Hi @paulgilbert2000

Try this:

Filter By <$select  tiddler=<<currentTiddler>>
field="statusfilter">
<option disabled></option>
<option value="[all[]]">any</option>
<option value="[status[in progress]]">in progress</option>
<option value="[status[Completed]]">Completed</option>
</$select>

<$set name="statusfilter" value={{{[{!!statusfilter}]}}}>
<$list filter="[subfilter<statusfilter>tidtype[task]]">

The trick is to add a value attribute to the <option> elements, which contains a subfilter. Then, a new “any<option> can use a value subfilter which is valid for any tiddler (I chose [all[]] but other filters might also work).

Fred

1 Like

Another option may be has a status field with no value yet set

  • [all[tiddlers]has:field[status]!has[status]]
    • Is tiddler (not shadow tiddlers) has the field status, does not have a value in the field status. ie only tiddlers with an empty status are listed.
  • All filters could include a partial filter to limit tiddlers first only to tasks such as [all[tiddlers]tag[task] or from the original question [all[tiddlers]tidtype[task].. because this quickly limits the number of tiddlers to be tested.

@tw-FRed Thank you Fred
@TW_Tones Thanks tones, unless i missunderstood you , but wouldn’t this return all tiddlers with no status ? instead of returning all tiddlers with any status,

i mean wouldnt this condition act as a “No” instead of “any”

It would return all tiddlers with the status field not currently assigned a status.

  • You decide what it means, but the advantage of using the presence of a field (even if empty) is because it serves a similar role to a separate tag.

For your reference;

  • has:field[status]!has[status] has an empty status field
  • has[status] has any status except empty
  • has:field[status] any status including empty
  • !has:field[status] does not have a status field with any value including blank
1 Like

That was very helpful, thanks a lot tones:)

1 Like