Cade,

Sub filters need to be full syntactically correct filters in their own 
right, in fact this may allow you to test them independently of your larger 
combined filter. 

Subfilters that respond to the filters so far are appended as such 
restoffilter]subfilter<filter-varname>] <= end of run
restoffilter]subfilter<filter-varname>nextoperator[] <= continue run
[subfilter<filter-varname>] <= a run on its own which generates its output 
along with other runs

However rather than make large compound filters I like to break the problem 
down and build nested lists with each handling part of the filter.

   - The advantage here is you can output intermediate results

This snipit shows how one list provides input to another (if you are not 
making use of the currentTiddler

<$list filter="firstfilter eg get states" variable=each-state>
  Show State<<each-state>><br>
   <$list filter="[<each-state>get towns" variable=each-town>
     Show Town <<each-town>><br>
   </$list>
</$list>
Once you have your complex filter working you can remove the show lines you 
don't want, and have only the output you intended

   - This helps building and debugging, now and subsequently.
   - This helps reuse and repurposing because it is more self documenting 
   than a single filter
   - In very few cases is this nesting has much greater overheads than a 
   single filter.
   - Combine this with a few subfilters that are also reusable, and can be 
   defined in tiddlers using the $:/tags/Macro tag


In time you will also learn how to write such nested lists to once working 
convert it to one long single filter if you want. 

Such filters can be placed in a filter field of a tiddler 
tagged $:/tags/Filter and a few other settings to make the filter available 
in the advanced search filter drop down;

Then you then can also use filter={{tiddlername!!filter}} or 
filter="[{tiddlername!!filter}] in your filter parameter.

Regards
Tony

On Thursday, 1 October 2020 09:47:41 UTC+10, 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/5c6e4043-b5dc-44e7-a5c7-d3d616e9aa26o%40googlegroups.com.

Reply via email to