I was thinking that the psuedofield would only exist in the context of the 
filter (and only during the execution of the filter), it wouldn't add 
anything else using the tiddler or make changes to the tiddler. Anyway, 
it's all hypothetical until someone codes it. I'll be happy to give it a 
crack once I wrap my head around things and get the drive for more powerful 
filtering. I might go the other path and have custom Javascript callbacks.

On Sunday, 15 October 2017 02:02:26 UTC+11, Mark S. wrote:
>
> I can imagine there would be great objection to "let" -- you're not 
> supposed to modify the tiddlers generated by a filter inside of the <$list> 
> structure. 
>
> It would probably be better to create your own SQL-like parser macro or 
> widget. Now there's a project! It might even be that someone has written a 
> javascript SQL emulator library. Seems likely.
>
> Another approach that doesn't break how TW works would be a javascript 
> macro that might work like:
>
> prefix:num10[field]
> prefix:trim10[field]
>
> which would prefix the title with a padded numeric field (we would assume 
> the field was well behaved) or a trimmed (padded on the right) text field. 
> You could then use as many as these as you wanted to build up a sortable 
> title. 
>
> Then there would be a trim filter like this
>
> deprefix[<number>] which would remove <number> of characters from the 
> input title, restoring the original title.
>
>  
> Something to think about --
>
> Mark
>
>
> On Friday, October 13, 2017 at 4:15:40 PM UTC-7, Berne Campbell wrote:
>>
>> I guess ultimately I want something like SQL, in SQL I can do multiple 
>> levels of sorting, and I can also run a function on input and then have 
>> that output be the input of another function. So I can do SELECT * FROM 
>> foobar WHERE (CAST(length AS NUMBER)) < 10 ORDER BY length, title DESC; <-- 
>> Probably incorrect SQL syntax but trying to illustrate what I mean.
>>
>> I was thinking something like "[tag[foobar]has[length] 
>> let:pseudolength[int(length)] lessthan:pseudolength[10] 
>> sort[pseudolength,title]"  where pseudolength is a temporary field created 
>> by the let operator, and int(length) will convert a alphanumeric field into 
>> a numberic field (e.g. "10 feet" becomes 10, and it has type int), when 
>> sort comes along it can take multiple fields, and because the pseudolength 
>> field is of type int it sort it numerically, whilst title is sorted 
>> alphabetically. Something like this, or being able to specify some custom 
>> javascript like a callback for converting or sorting, would be nice.
>>
>> On Saturday, 14 October 2017 06:31:59 UTC+11, Jed Carty wrote:
>>>
>>> I can see how we can do all of that other than the zero padding in just 
>>> wikitext, but without the zero padding the sort will break because it would 
>>> be an alphanumeric sort. Perhaps we need to make a padding filter, it 
>>> shouldn't be too difficult to implement and I think it has come up before.
>>>
>>> For anyone who doesn't know the details of the sorting, the problem is 
>>> that there are two types of sorting done in tiddlywiki, it can be numeric, 
>>> where things are ordered according to numeric values and 10 comes after 2 
>>> because the number 10 is greater than 2. The other sort is an alphanumeric 
>>> sort where 10 comes before 2 because the first character in 10 comes before 
>>> the first character in 2 when sorted in the order that the characters are 
>>> sorted in the character encoding used. If you have something that has both 
>>> numbers and letters in it than it can not be sorted using the numeric 
>>> method using built-in functions.
>>>
>>
>

-- 
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/df65808d-56d2-4fe9-8a4a-3b4861fa3ea7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to