I also have an agent which brings together all the notes descendedFrom the Notes container, so of course, the Sections and the notes are mingled together on the agent map, which is what I want.
In the map view of the agent, I can manually link each note’s alias to its aliased Section, like so:
But this gets tedious if there are many chapters and notes. I’d like to create a stamp which automates this: selecting a section alias would create the links to the aliases within this map, without affecting either the original sections or notes.
I’ve got as far as the simple stamp below, which creates links to the original, but of course that’s not what I want here.
All section notes can be identified/filtered via a prototype.
Any note aliases in the agent map know that they don’t have the pSection prototype and that their section is the $Name of their original’s parent.
We need a link from each section TO each note of which it is a parent (in the outline)
For the stamp:
Add string attribute $Section. Add prototype ‘pSection’. Customise if you want, as it mainly marks sections distinct from non-section notes but give it OnAdd of : $SectionName=$Name(parent);
Set all Sections’ child notes to use prototype ‘pSection’. Promote/re-nest section’s child notes to fire the OnAdd. All notes part of a project now store their Section in $SectionName.
Agent query: descendedFrom(/Test/Notes) (no quotes as a literal path)
Make a list of $IDs all Non-section notes (could use a path but $ID avoids issues of two same-$Name notes:
Iterate the list (list.each()) and use linkFrom() to make a link from [sic] the section alias to the in-loop currently processed alias.
The alias knows its section as it is $Name(parent(original)). Now we can match the sibling alias of that name as the source of the link
…but it turns out linkTo/From operators don’t operate as expected with aliases (or aliases inside agents). … omitting many things that didn’t work, assuming you set $SectionName as above, the stamp below works.
IMPORTANT: the stamp must be applied direct to the agent’s aliases and not via the agent. Why? This routes around a limitation of the existing linkTo(0/linkFrom() capability. The stamp is
In my demo doc linked below, I’ve now removed the links shown above. In the TBX ignore logs and stamps not recommended—I’ve burned loads of time to get to here so no time to prune testing extras. To try the code (in v10.1.2b710):
open the TBX
select all aliases inside the agent. IMPORTANT: don’t select the agent itself.
apply stamp “Link up sections 2” [sic] to the above selection.
“But I wanted to just stamp the agent!”. Indeed—well so did I, but to do that requires improvements to the current (v10.1.2) app. the above works today and selecting all the agent’s aliases isn’t such a big deal.
If I get some time I’ll address the linking limitations on the Backstage, so seasoned hands can check i’ve not missed something.
I’d envisaged a much simple—for the user—system not needing the prototype and user attribute and only needing to stamp the agent, but alas that needs functionality not currently in the app.
I’ve just got back in, so haven’t had time to look at it in detail, but I wanted to say thank you immediately – it looks like it took a lot of work to get there (and no wonder I got nowhere near!)