Sort by adding date (for cleanup)

The clean up feature for notes is very helpful.! :laughing:
Is there a field to clean up in the order in which they are “added timing into the Container”?
“OnAdd” did not work.

I use the Containers to keep the screen clean by throwing processed notes into the Containers.

So when I organize them later, I want to arrange them in the order in which they were put in the Containers, not in the order of Created, Modified date or Name.

Use the container’s OnAdd and a user Date-type field (Date is a date and time), let’s call it ‘SortDate’ date.

OnAdd code:

$SortDate = date("now");

Set the container sort order on SortDate, here shown in the Inspector:

This sorts oldest first - if you want the most recent to sort first tick the ‘reverse’ box (which sets $SortBackward).

Result, when implemented (column view just for screengrab purposes):

If you want to do this for lots of containers, make a container with the above settings, move it to your Prototypes container (ensuring it becomes a prototype) . Then, whenever you need a new ‘sorted’ container, you can use the prototype.

Or, if you need to use prototypes for other purposes, this stamp will set up the container settings needed:

$OnAdd = '$SortDate = date("now");';
$Sort = "SortDate";
// uncomment next line for newest first
//$SortBackward = true;

Note the last option (re time=-based sort order) is commented out—see discussion of this point further above.

Here is a TBX showing all the above, including the stamp: sorted-container-test.tbx (107.4 KB)

Thanks for great support!! :heart_eyes:

$SortDate = date("now");

It works, but the newest one is left… is it possible to make it the newest one right side? (when I clean up them row)
(left to right like the nomal time line)

Do you mean in map view? What clean-up layout are you using?

Tip: for things like sorting, even in maps, first make it work in outline, then map and other views should work. The outline order ($OutlineOrder) informs all views.

I assume the map clean-up uses the outline container sort order, i.e. $OutlineOrder. So the first listed will be top left of [whatever layout] grid pattern you use for clean-up. How the rest follow will depend on the pattern you choose.

Did you not try the reverse sort ($SortBackward) option I described in my previous post? Does it not change the clean-up order?

HTH

@eastgate has kindly confirmed, elsewhere that clean-up:

  • uses $OutlineOrder
  • progress goes left to right, top to bottom, i.e. as in writing on a page in a European-type left-to-right language.
    • a box layout starts top left and then orders clock-wise back to the start.

As a result have updated Re-arrangeable Agent Maps and Cleanup Action pop-up list. The former explicitly mentions that the ‘reverse’ box on the Sort Inspector is way to reverse sort order as it might not be self-evident to the newer/less-experienced user. See the per-data-type child notes to this article for per-data-type default sort ordering.

Hopefully this makes this issue a bit clearer. :slight_smile: