On Monday, January 18, 2016 at 9:25:36 AM UTC, Eric Shulman wrote:
>
> On Monday, January 18, 2016 at 12:21:31 AM UTC-8, Richard Evans wrote:
>>
>> I have been exploring the filter mechanism in TW5. First I am surprised 
>> to find it classified as a Concept, rather than as a Widget, but as I have 
>> said before the logic of the TiddlyWiki language escapes me.
>>
>
> Filters can be used as parameter values for several different types of 
> Widgets, including $list, $set, various $action-* widgets, etc.  They can 
> also be used in some special cases, such as entering a filter expression 
> into $:/DefaultTiddlers to automatically compute which tiddlers are to be 
> shown at startup (e.g., put [tag[startup]] in $:/DefaultTiddlers, and then 
> just add the "startup" tag to any tiddlers you want displayed).
>

Thank you interesting information, but not exactly germain to my question. 

>  
>
>> If I use the following code:-
>>
>> <ul><$list filter="[tag[Use Case]]" sort="title">
>> <li>
>> <$link><<currentTiddler>></$link> 
>> </li>
>> </$list></ul>
>>
>
> A very strange thing has happened, when I was editting my file yesterday, 
I was getting the result I described, but today when I opened the file, my 
results had changed to:-


   - 1.0 Use Case
   - 2.0 Use Case
   - 2.1 Use Case
   - 2.1.1 Use Case
   - Add Case
   - Multiply Case
   - Subtract Case

Which is the expected behaviour. It would seem TiddlyWiki has bugs.
 

> The documentation for the <$list> widget does not include mention of a 
> sort="..." parameter, 
>

No <$list> does not mention of a sort parameter,  but  
<$list filter="[tag[Use Case]]" sort="title"> 

works try changing title for 'created' or some other sort operation.  Even 
though it is not documented it seems to work. Your suggestion of 
<$list filter="[tag[Use Case]sort[title]]">
does exactly the same thing in my limited testing.


so I don't think any sorting actually occurred.  Rather, I think you are 
> just seeing the "natural" order (based on creation) of the tagged tiddlers. 
>  To actually sort the filter output, you should use the [sort[]] filter 
> operator, like this:
> <$list filter="[tag[Use Case]sort[title]]">
>  
>
The original point I was making is that the order produced was un-natural 
from my point of view, putting numbers after characters.

Am I alone in thinking that a filter is different from a sort? Making sort 
>> subsiduary to filter seems illogical to me.
>>
>
> Filter operators work by modifying the current "input set" in various 
> ways... adding, removing or changing the order of the items in the set.  By 
> default, the input set starts with all 'real' tiddlers (excluding shadow 
> tiddlers).  The [tag[...]] operator then selects only those tiddlers with 
> the indicated tag value.  The [sort[...]] operator then alters the order of 
> the set of tiddlers.
>
> Sorting a set can be integral to the logic of filtering.  For example, 
> suppose I want to list, in alphabetical order, the ten most recent tiddlers 
> tagged with "task".  To achieve this, the filter expression would be:
> [tag[task]!sort[modified]limit[10]sort[title]]
>
> This is an argument for re-using code not for subsuming the sort operation 
into filter.

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/03651bcc-0c06-4560-82c8-92d1dcd9c0fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to