Just to add a hopefully helpful example. You can store filters not only as
macros, but in fields and data tiddlers.
While learning and experimenting with some wikis I was inconsistent in my
use of tags. I used a data tiddler to define filters until I got things
cleaned up and simplified.
filter data-tidder:
title:filters
tasks:[tag[task]] [tag[Task]] [tag[Item]]
use:
<$list filter="[subfilter{filters##tasks}!tag[Done]]"
template="task-template"/>
Live example
<http://amreus.tiddlyspot.com/#subfilter%20example%3A%20tasks:%5B%5Bsubfilter%20example%3A%20tasks%5D%5D%20filters%20%5B%5Btask%2FClean%20the%20apartment%5D%5D%20%5B%5Btodo%2FGo%20food%20shopping%5D%5D%20%5B%5Btask%2FMake%20coffee%5D%5D>
On Wednesday, September 30, 2020 at 8:53:13 PM UTC-4 [email protected]
wrote:
> As Tony mentioned, subfilters have to be "complete filter runs", not just
> a series of operators. Try this, with the enclosing square-brackets:
>
> \define obsname()
> [contains:ascend.observation.name
> {$:/ascend/state/observation.name.selected}]
> \end
>
> "subfilter<obsname>" in your main filter will then pass each individual
> title to the subfilter as input, returning all that pass.
>
> Best,
> Joshua F
>
> On Wednesday, September 30, 2020 at 4:47:41 PM UTC-7 Cade Roux wrote:
>
>> You have an example I can look at somewhere? I just tried to extract one
>> of the filters and it doesn't appear to be working - probably because of
>> the curlybracket reference to the value of another tiddler set by the
>> dropdowns?
>>
>> \define obsname()
>> contains:ascend.observation.name
>> {$:/ascend/state/observation.name.selected}
>> \end
>>
>> Then I tried to use it as subfilter<obsname> in the filter where that
>> original filter was and the filter no longer works as expected.
>>
>> I think I need to make up a toy version of this wiki so people can see it
>> in action.
>>
>> Thanks,
>>
>> Cade
>>
>> On Wednesday, September 30, 2020 at 6:22:25 PM UTC-5 [email protected]
>> wrote:
>>
>>> You can define sections of that filter as macro definitions, and then
>>> call them with "subfilter<macroFilter1>".
>>>
>>> I.e. "[all[tiddlers+shadows]tag[MyTag]subfilter<macroFilter1>
>>> subfilter<macroFilter2> sort[]]"
>>>
>>> Define them at the start of the tiddler which is using the filter, or
>>> define them in other tiddlers and import using the "\import
>>> filter-to-import" Pragma at the top of the text field where the filters
>>> will be used.
>>>
>>> Best,
>>> Joshua Fontany
>>> On Wednesday, September 30, 2020 at 10:41:23 AM UTC-7 Cade Roux wrote:
>>>
>>>> What is the best technique to break up very long runs in a filter
>>>> (preferably to different lines)? Can't use whitespace since that
>>>> separates
>>>> runs. I have a filter that is currently 382 characters.
>>>>
>>>> It selects a subset of tiddlers on one field, then four other fields
>>>> individually have to have tags matching four dropdowns which allow the
>>>> user
>>>> to filter, and then it is sorted. Some of that can be mitigated with
>>>> shorted field names, but it still is unwieldy in most editors.
>>>>
>>>> Thanks,
>>>>
>>>> Cade
>>>>
>>>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/7fba6dda-d926-4b22-9d28-0d98266fbfa8n%40googlegroups.com.