Tinderbox Forum

Order of notes in outline view

Is there an attribute to reorder the notes in outline view - without using sort. I would like to create a note the appears in 1st place of my outline view.

Can’t you just manually drag it there? Otherwise I’m afraid I don’t understand the question.
In the Finder I solve that problem by starting the name with a space („ Note“) and then sort on it.

I just create a new Attribute and populate it with numbers or letters that I can sort by.

I would like to place it via ActionCode… there has to be an internal attribute to make this happen…

I concur. Either sort or manually drag - those are the options. $SiblingOrder and $OutlineOrder are read-only so you can’t write a code like:

if (condition is met) { make me first sibling in my container)

I’d agree using $Sort can be troublesome, as once set it runs continuously until reset. I’ve a long-standing feature request to be able to do a ‘one-time’ sort on a container. IOW, sort it on a given criteria and once items are sorted revert to no applied sort.

Why? If you try to do this via action code, in a single action, it fails as Tinderbox can’t be told to wait until the sort is complete before negating the $Sort setting:

// This does *not* work as intended , used on the parent container
// sort children using $MyNumber
$Sort = $MyNumber;
// sort done, now reset to normal;
$Sort =;
// failure as latter fires before *effect* of first is complete
// action code has no 'wait' mechanism
// events like completion of a single sort - timing dependent on the rule cycle - aren't exposed

You could use a discrete action (stamp?) for each step but then the user has to wait and judge when the sort has run at least once before applying the second action. So, not very automated. :slight_smile:

Based on what criteria, i.e. what data value?

simply I would add a note with create and make sure that it will become the first note in the outline view (I’m creating my default setup for a new file with action code).

P.S.: and what a funny country with a “nobody told me that it is illegal” leader you have. Here in Germany we take everything so serious - party poopers we are :slight_smile:

Best summed up by one headline “No one told me it was illegal says man who sets rules”. It would be funnier if it were someone in a less important role. Instead, regardless of party affiliation, it is not the nation’s finest hour.

3 Likes

Ah, you want the equivalent for create() of Shift+Return vs Shift+Option+Return when manually adding new notes.

I think that is essentially a feature request for something like create(item [, blnFirst]). Thus we retain the status quo (child is added as last sibling):

create("taps");  // adds new last child to current container

and new:

create("taps",true);  // adds new first child to current container

pinging @eastgate

1 Like

Sorry I don’t possess the coding skills to present this suggestion correctly - but to my mind, it could be done via:

  • Create User Attribute $Sorter
  • Create Container One
  • Set $Sort status of Container One
  • Create Note A within Container One
  • Set $Sorter value of Note A to “1”
  • Create subsequent Notes as needed, and
  • For every new Note, assign an incremented/decremented value of $Sorter

You could also programmatically assign values <1, in effect “pinning” said Note/s at the top of the list.

Seems like this could be done in action code, am I wrong?

1 Like

Thanks, though this breaks the OP’s request to avoid using sort :slight_smile: , I still think @archurhh’s solution above could be made to work. However, you’d first need to check if any existing children had a $Sorter value of 1. If so, that would need to be deleted before adding the new note or you’ve two notes with a $Sorter value of 1 which may result in a wrong sort order.

Something like this stamp (tested in v9.1.0):

// Requires user attribute 'Sorter', number-type.
// Container's $Sort should be set to "Sorter' and sort in reverse order,
//    $SortReverse set to true, so that 1 sorts before the 0 in all the other notes

// Zero out any existing Sorter value(s)
$Sorter(children)=;
// Now make new note
var vNote = "/path/to/note/or/name/of/note";
var vPath = create(vNote);
// vPath now holds the confirmed $Path for the newly created note
$Sorter(vPath) = 1;

This works, although the create() call doesn’t refresh sort (I was using Outline view in my test FWIW). So, you either have to wait for the next update cycle or flush via the File ▸ Update Agents Now … which of course you can’t do via action code! But…

… the real fix isn’t this forced sorting but rather having the (presently missing) ability to make a new action-code-created note be placed as first child rather than last child as is the current and only behaviour. A feature enhancement to that end has already been suggested in my previous post above.

HTH

1 Like