Added to TW-Scripts

On Friday, March 29, 2019 at 4:19:01 PM UTC+4:30, Jamie Choi wrote:
>
> Thank you for your reply. "nsort[toc-order]" is indeed the way to go. I 
> will show an example here:
>
>    - Post "Home" with toc-order = -1
>    - Post "Book" with no toc-order
>    - Post "Events" with no toc-order
>    - Post "Footer" with toc-order = 1
>
> Using "sort[title]nsort[toc-order]", the list is:
>
>    - Home
>    - Book
>    - Events
>    - Footer
>
> It seems that it *does* have an default value of 0 *if I use nsort 
> instead of sort*, which is what I should be doing. Thanks for everyone's 
> help here!
>
> On Thursday, 28 March 2019 22:13:23 UTC+8, S. S. wrote:
>>
>> Eric,
>>
>> Thanks for that explanation! I had not absorbed that concept properly.
>>
>> A small test shows that when using *sort[toc-order]* or 
>> *nsort[toc-order]* - the empty/non-existent toc-order values *go to the 
>> top of the list*, followed by those that have a value of 0, then the 
>> other numbers below.
>>
>> So depending on what one wants, doing a *!nsort[toc-order]* might 
>> accomplish what is needed.
>>
>> Otherwise, perhaps use the Tiddler Commander Plugin 
>> <https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/YQU3ATb5r3k> 
>> to add the field and the wanted values to all the tiddlers without that 
>> field quickly.
>>
>> Regards
>>
>> On Thursday, March 28, 2019 at 8:44:45 PM UTC+7, Eric Shulman wrote:
>>>
>>> On Thursday, March 28, 2019 at 4:04:57 AM UTC-7, S. S. wrote:
>>>>
>>>> I haven't understood what you mean by "sort[toc-order]"
>>>>
>>>
>>> The second parameter of the toc-selective-expandable macro uses filter 
>>> syntax to apply a sort order to the set of tiddler being displayed at each 
>>> level of the tree.
>>>
>>> "sort[toc-order]" means "sort the list of tiddlers by the value in the 
>>> "toc-order" field of each tiddler.
>>>
>>> Thus, if each tiddler has a "toc-order" field containing a number then 
>>> when those tiddlers are shown in the tree, they will be sorted based on 
>>> those numbers.
>>>
>>> The problem is that tiddlers where the "toc-order" field is missing (or 
>>> blank or non-numeric) are sorted AFTER the tiddlers that do have a defined 
>>> value for "toc-order", and Jamie was asking how to get these un-numbered 
>>> tiddlers to default to being placed BEFORE the sorted ones.
>>>
>>> Note: for his purposes, Jamie should be using "nsort[toc-order]", which 
>>> does a NUMERIC sort, rather than an ALPHABETIC sort.  With alpha sorting, a 
>>> sequence of numbers like "1 2 3 10 11 21 22" will be sorted as "1 10 11 2 
>>> 21 22 3".
>>>
>>> However, just like the sort[...] filter, nsort[...] also puts 
>>> missing/blank/non-numeric values at the end of the list.  So, although 
>>> nsort[...] is correct, it still doesn't solve the original problem.
>>>
>>> -e
>>>
>>>

-- 
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/148d9cd8-9173-4da6-b387-bc810de38313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to