Tinderbox Forum

Sorting a container outline in the same order as its map (was: Moving between map and outline)

This is branching from this post in a different thread where @kderbyshire notes:

At first encounter it might seem odd that Outline order ($OutlineOrder) doesn’t seem to reflect the Map view. But, pause to consider. If I move a note on the map, which direction(s) of movement should affect the outline. there isn’t an obvious answer, which is why map position ($Xpos and $Ypos) don’t affect outline order.

However, the stacking order of the map, the Z-plane (i.e. which overlaps in front/behind another note) does follow outline order.

In our mind’s eye we may imagine a left-to-right-order in our map or an order flowing allow a set of linked notes, but the app can’t see that. If you need the outline to reflect your abstract order on the map, I’d suggest adding a user Number-type attribute (or use $MyNumber) to record the sequence, then set the sort of the map’s container to sort on that value.

. Yet another good reason not to make a long-term, meaningful map at root level, i.e. the map you see on starting a new doc. Better, make a note on that map that is the container of your map to be, drill down and start adding your data there. It also avoids things like a Prototypes or Templates container appearing in your map.

For more detail on ‘order’ in map vs. outline, i’ve written a set of notes here.

A feature to scan a map left to right, top to bottom and put aliases of every note found into a special container (let’s call it “Map Scan” for now), would be very useful.

I will stipulate this is a less than perfect solution because Tinderbox will make some incorrect decisions as it scans, but it might be better than nothing, which is what we have now. In most cases some amount of cleanup on the “Map Scan” outline container will be required.

Before we say: “this will never work” or “that’s not what maps are for”, consider that other applications have features similar to the suggestion and have managed to figure out workable – imperfect but workable – solutions. (E.g., copying everything on a Curio workspace as a list.)

I think “moving from map to outline” and “getting my stuff out of Tinderbox” are probably two of the “hard problems” that bedevil users no matter how long they’ve been working with Tinderbox. There are no universal answers to either problem, but there can be aids.

1 Like

This used to be a nuisance, but now we have text export, rich text export to RTF, Word, OPML and Scrivener, attribute browser export to RTF/Word and to spreadsheets, and astonishingly customizable HTML/XML export. Plus, our XML file format is easily used by other programs. I propose that, in 2020, no application has a richer repertoire of export facilities.

A feature to scan a map left to right, top to bottom and put aliases of every note found into a special container

Make an agent! (corrected)

Name: Map Scan
Query:: inside(/path/to/containerOfInterest)
Sort: $Ypos(original)
SortAlso: $Xpos(original)

Gildling the lilly slightly, we don’t want small differences in Ypos to be significant. So, sorting by floor($Ypos(original)/2) or something like that might be better.

1 Like

ADMIN’s later annotation: Jump to this post below for a corrected/simplified solution. I’ll leave the interim posts as I think they show some useful de-bugging practices, e.g. test files with small samples.

Interesting here is solutions emerging owing to the thread starting with a problem case - difficulty extracting map ‘order’ to the linear outline order needed to feed export—be it HTML, RTF, whatever—as this is often ‘just’ a next step, but critical, to moving content to another app.

Is this what is supposed to work? (The attribute names seem to be “Sort” not “SortBy” and “SortAlso” not “AlsoSortBy”). Anyway my guess, below, does not work.

1 Like

I think you are correct on the names (q.v. $Sort and $SortAlso) of attributes, but these are set on the agent. If applied in the $AgentAction, you are actually setting $Sort/SortAlso for the aliases of the matched notes, thus the lack of results.

Perhaps we can re-qrite the above as:

Agent’s $Name: Map Scan
Agent’s Query: : inside(/path/to/containerOfInterest)
Agent’s $Sort: $Ypos(original)
Agent’s $SortAlso: $Xpos(original)

To apply the suggested revision, the $Sort becomes floor($Ypos(original)/2) .

Note in all the cases here, you can’t use the Action Inspector ‘Sort’ tab to set Sort & SortAlso values as the inspector can only set an attribute name as a value and not an action code expression as needed here.

1 Like

No joy:

This map

with these settings in the agent

gives this result

Screenshot of Tinderbox (12-7-20, 11-22-52 AM)

So, no dice.

Map Scan Example.tbx (92.7 KB)

FWIW – I am very glad I recently retired so that I can now devote my time fiddling with test files to figure out why something that “should” just work in Tinderbox, actually doesn’t. :rofl::rofl:

1 Like

Reverse the sort order :slight_smile:

I was tinkering with this earlier (had to take call) and grokked the reverse sort bit but I know want to check and confirm number sort. IOW, low to high or vice versa and positive negative sorting correctly on the number line as something seems amiss (likely procedural as opposed to a bug). But rather with some other things one can solve with expertise, I already sense there are more moving parts than those needing this sort of structuring will easily understand. Still, moving towards progress.

A very interesting thread, but spawned by my overly casual use of language in the original post.

I’m fine using the Outline view to actually put things in order. The specific challenge is:

Given a group of notes arranged on an Adornment in Map View, assign an Attribute that can be used to view those notes in a linear view for more precise ordering.

I’m not sure this is on topic, but I’m going to jump in if only to say that the separation between the views is valuable.

When I started using TBX back in v.5.x the thing that impressed me about the app was the fact that outline order and map arrangements were completely independent of each other. In the intervening years a few small, reasonable changes have chipped away at that independence—I think most emerged around the introduction of composites—but for me, they represent a tangible loss.

All of which to say that efforts to coordinate the views through user action are great, but I hope the app itself will maintain (or improve) the separation between the views.

This thread is not about eliminating the separation between maps and outlines. No one is suggesting changing Tinderbox software or Tinderbox’s behavior in that respect. This is about technique, not enhancement.

The thread asks “if I arrange the notes in a container on a map, can I configure anything so that the notes in the container have the same top-to-bottom-left-to-right sequence as the map”. It is entirely optional whether one wants to do this or not.

One technique is as follows – there are probably others. Say you have a container of notes – call it “Notes”.

Configure the container’s sort attributes as shown.

This is a limited, toy example. It does not address more sophisticated cases – containers with aliases of notes from other containers; composites, etc. It does not address the question:

Correct Answer

due t some confusion up thread, those testing were sorting an agent, rather than the maps container. Recall, outline order ($OutlineOrder) isn’t seen on the map (except when notes overlap).

In short, set your map’s container sort options to:

There is no need to set ‘original note’ in the pop-up because you are already acting on the original note. Earlier discussion about using agents was a red herring (and this leading to the false trail above).

So, now we know. It’s much easier than imagined to get the outline order of a container to reflect its map layout in a broadly left→right, top→bottom-right order (akin to English as written on a page). If you need a different orientation swapping the Ypos and Xpos order of application and/or using the reverse sort setting may help.

Before someone points it out this doesn’t cover mapping all layouts. If nothing else, it might suggest to anyone starting a new doc that a top-left/bottom-right progression makes it earlier to transpose to a (linear outline order). If the map is essentially finished and you want to export but have a branching structure, consider nesting branches in the map inside their starting note. These will also nest in the outline So you could apply the same sort to this new container). some assembly required, but a small once-only task.

A practical use case for sorting a container the way its map is organized

Here is one alternative use of the technique.

Problem: “I have a container (“My Notes”) – or multiple containers – that have been organized in Map view, but I want to export some or all of the the notes in a different order.”


  1. Create an agent that gathers the notes you want to organize.
  2. Set $CleanupAction for that agent to none – this will prevent changes to the map layout in that agent’s map view whenever the agent query refreshes.
    2 Open a map view on that agent and organize the notes the way you want.
  3. Configure the agent with

$Sort == Ypos
$SortAlso == Xpos

The notes in the agent will now be arranged in top-to-bottom-left-to-right order as on the map. You can export the notes from the agent in the sequence you arrange in the map.

EDIT: I believe, without testing, that a smart adornment on a map could populate an attribute in all the notes residing on that smart adornment. For example: if I sit on a smart adornment, then $MyBoolean == true. Then an agent could query the container that the map where that smart adornment lives and just pick out the notes with $MyBoolean == true. Apply the “map ordering” technique described above, and you have an answer to this question raised by @kderbyshire.

In the answer above, I’m missing out the cause of the use of an agent. The question posed is entirely sensible. Now we’ve figured out the process, you don’t need an agent as we can set the ‘map’ order as shown in the last post.

But let’s say that for whatever reason, you actually want to use an agent with these notes (outline ordered as for the map). You have two choices:

1. Use a sorted map container
In this case simply point the agent at the container. Agents normally sort on the target items outline order but if yu think it looks wrong, sort the agent on ‘Name’ and ‘original note’.

2. Unsorted map container, sort in the agent
This is closer to the original context proposed above. In that case you agent’s sort Inspector should be set like so:

So, with @PaulWalters’ last, hopefully @kderbyshire now a nice range of simple solutions for making outlines reflect the map. :slight_smile:

4 posts were split to a new topic: Making use of community solutions

I second your proposal, Mark. There are so many ways to get data in and out of Tinderbox that no one could feel locked in or locked out. Thank you, you’ve done a great job.

I do not yet use the Export Template system partially because I have been able to do whatever I need to get material out of Tinderbox already.

1 Like