[tw5] Re: Breaking up very long runs in a filter?

2020-10-02 Thread amreus
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 


On Wednesday, September 30, 2020 at 8:53:13 PM UTC-4 joshua@gmail.com 
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" 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 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 joshua@gmail.com 
>> wrote:
>>
>>> You can define sections of that filter as macro definitions, and then 
>>> call them with "subfilter".
>>>
>>> I.e. "[all[tiddlers+shadows]tag[MyTag]subfilter 
>>> subfilter 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7fba6dda-d926-4b22-9d28-0d98266fbfa8n%40googlegroups.com.


[tw5] Re: Breaking up very long runs in a filter?

2020-09-30 Thread Joshua Fontany
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" 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 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 joshua@gmail.com 
> wrote:
>
>> You can define sections of that filter as macro definitions, and then 
>> call them with "subfilter".
>>
>> I.e. "[all[tiddlers+shadows]tag[MyTag]subfilter 
>> subfilter 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/83c6bb8e-499f-4421-8141-ae84cabb2c57n%40googlegroups.com.


[tw5] Re: Breaking up very long runs in a filter?

2020-09-30 Thread TW Tones
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] <= end of run
restoffilter]subfilternextoperator[] <= continue run
[subfilter] <= 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<>
   <$list filter="[get towns" variable=each-town>
 Show Town <>
   

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 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 joshua@gmail.com 
> wrote:
>
>> You can define sections of that filter as macro definitions, and then 
>> call them with "subfilter".
>>
>> I.e. "[all[tiddlers+shadows]tag[MyTag]subfilter 
>> subfilter 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5c6e4043-b5dc-44e7-a5c7-d3d616e9aa26o%40googlegroups.com.


[tw5] Re: Breaking up very long runs in a filter?

2020-09-30 Thread Cade Roux
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 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 joshua@gmail.com 
wrote:

> You can define sections of that filter as macro definitions, and then call 
> them with "subfilter".
>
> I.e. "[all[tiddlers+shadows]tag[MyTag]subfilter 
> subfilter 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/786aedea-a793-48f4-97c7-bb528284af2dn%40googlegroups.com.


[tw5] Re: Breaking up very long runs in a filter?

2020-09-30 Thread Joshua Fontany
You can define sections of that filter as macro definitions, and then call 
them with "subfilter".

I.e. "[all[tiddlers+shadows]tag[MyTag]subfilter 
subfilter 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/06bce3d8-7226-40a1-8003-0f55cce19b6en%40googlegroups.com.