I have a container called Data. Within this container I have an assortment of notes + containers. What I am trying to do is to sort all my notes first by Name without the containers, then group my containers together and sort them by name. How would I do this…
Ex of what I am trying to do
a note1
b note2
c note3
a noteContainer1
b noteContainer2
c noteContainer3
So how about if your first sort was $ChildCount, which serves to distinguish containers from mere notes? I don’t think there is an attribute called $IsContainer, but $ChildCount (I think) gives you the same info. Any container will by definition have a $ChildCount of >0, while any note will by definition have a count of 0.
Then, your second-pass sort could be by $Name.
I think that two-level sorting would give you first all your containers (or all your notes, depending on which way you order the sort), and then would sort each of those groups by name.
Right, experts?
Update I realize the flaw in my scheme! If you have containers with different numbers of child items, then you’d get the container part of the grouping sorted that way–that is, first the container with 1 child, then the one with 3 children, then the one with 10–rather than by $Name.
So how about this:
Create a new user attribute, $IsContainer
Create a rule or edict (at whatever is the appropriate point in the structure), saying that if $ChildCount>0, then $IsContainer=true, else $IsContainer=false.
Then set up the sort scheme so the first pass is on $IsContainer, and the second pass is on $Name.
As @JFallows notes, there isn’t a built in sort solution for this, but adding a single user Boolean-type attribute ‘IsContainer’, then a two-level sort can work. I tested the above solution and works for me: