Sorting question

102 views
Skip to first unread message

David Gifford

unread,
Dec 3, 2016, 11:07:27 AM12/3/16
to TiddlyWiki
Is there a way to sort tiddlers in two ways at once?

I have an open all button, and I would like to have it sort

1. First by the first tag of the tiddler
2. Within the tiddlers tagged with that tag, sorted by text in a field of my choosing. Let's say alphabetically by the contents of the "ordering" field I have added to the tiddlers.

This way by clicking open all, the tiddlers with a certain tag are grouped together, and within that group I can control the order by the ordering field.

Dave

Jed Carty

unread,
Dec 3, 2016, 11:28:35 AM12/3/16
to TiddlyWiki
You can probably do this by cheating. First sort the tags, then for each group defined by their first tags sort by your chosen criteria, then append each list onto the list in $:/StoryList.

I am working on another thing right now, I will look at this after. For the moment the action-listops widget and set widget (using a filter) are probably your friends.

Jed Carty

unread,
Dec 3, 2016, 2:20:00 PM12/3/16
to TiddlyWiki
Ok, so this requires a few separate things:

1) The full list of tiddlers you are working with. This should be defined by a filter.
2) The first sorting criteria. We will go with the first tag listed since that is what you mentioned. Just be aware that this part is almost as complex as the rest of what you asked for all by itself. Luckly, I am magic and may be at the start of one of my hypomanic episodes. MAGIC!!
3) The second sorting criteria, we will go with sorting numerically by the value is the 'ordering' field

Note: If you have double quotes in a tiddler of tag name than it won't work correctly.

I have my doubts that this will ever be useful. You may be able to make it work with one button but I don't think so. Put in your filter for all the tiddlers and give the field you want to base the second sort on. If you want to sort by something other than the first tag than you may have to do that yourself.

\define OPEN() [[$(ThisTiddler)$]]

\define SecondFilterThing() $(FullListOfTiddlers)$+[tag<SortedTagList>nsort{$:/temp/FilterToSort!!secondsort}]

\define InnerThing()
<$list filter='[list[$:/temp/FancyShmancySortingMagic##$(currentTiddler)$]]' variable=ThisTiddler>
 
<$action-listops
                    $tiddler
='$:/temp/FancyShmancySortingMagic'
                    $index
=OutputList
                    $subfilter
='+[append<OPEN>]'
               
/>
</$list>
\end

Give me a filter:

<$edit-text tiddler='$:/
temp/FilterToSort' field='filter' class='tc-edit-texteditor'/>

Second sort field:

<$edit-text tiddler='
$:/temp/FilterToSort' field='secondsort' class='tc-edit-texteditor'/>

<$set
    name=FullListOfTiddlers
    value={{$:/temp/FilterToSort!!filter}}
>
    <$button>
        Fancy Shmancy Sorting Magic 1
        <$list
            filter=<<FullListOfTiddlers>>
        >
            <$list
                filter='
[<currentTiddler>list[!!tags]first[]]'
                variable=ThisTag
            >
                <$action-listops
                    $tiddler='
$:/temp/FancyShmancySortingMagic'
                    $index=TagList
                    $subfilter='
+[append<ThisTag>]'
                />
            </$list>
        </$list>
    </$button>
    <$button>
        Fancy Shmancy Sorting Magic 2
        <$list
            filter='
[list[$:/temp/FancyShmancySortingMagic##TagList]sort[]]'
            variable
=SortedTagList
       
>

<!--!<<SortedTagList>>-->

           
<$list
                filter
=<<SecondFilterThing>>
                variable
=ThisTiddler
           
>
<!--<<ThisTiddler>>-->
               
<$action-listops
                    $tiddler
='$:/temp/FancyShmancySortingMagic'
                    $index
=<<SortedTagList>>
                    $subfilter
='+[append<OPEN>]'
               
/>
           
</$list>
        </
$list>
   
</$button>
</
$set>

<$button>
Fancy Shmancy Sorting Magic 3
<$list filter='[[$:/temp/FancyShmancySortingMagic]indexes[]bf[]]'>
<<InnerThing>>
</$list>
</
$button>

Output:

<$list
    filter
='[list[$:/temp/FancyShmancySortingMagic##OutputList]]'
>

</$list>


David Gifford

unread,
Dec 3, 2016, 4:21:37 PM12/3/16
to tiddl...@googlegroups.com
hmmm...got a list of results from #3 of the three fancy sorting magic, but not the other two. And now even after refresh and changing the field etc, the original results I got stay locked into the tiddler. And none of the buttons open any tiddlers. Not sure what to make of this...

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/o3JQgcKRkjE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/79a6cab5-5d0e-4c58-b781-7408d0fe9d6d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
David Gifford
Christian Reformed World Missions, Mexico City

Jed Carty

unread,
Dec 3, 2016, 4:39:43 PM12/3/16
to TiddlyWiki
Yes, all three buttons are needed. They do different steps of the process. And none of them open anything, they just do the sorting. If you want to do something with the sorted list than will take more.

David Gifford

unread,
Dec 4, 2016, 6:35:35 PM12/4/16
to TiddlyWiki
No worries, and thanks again for your help. Blessings.
Reply all
Reply to author
Forward
0 new messages