I’ve started using exploded notes, and have created a stamp that gives exploded notes certain attributes from their grandparent. For example, $SourceURL=$NoteURL(grandparent) and various bibliographic details. However when I do explode a note, it would be neat if the actions included in this stamp could be applied automatically whenever exploded notes are created. I assume there is a way to do this but I cannot work it out.
The reason I always want such information to be attached to exploded notes is that if I use an agent to collect notes (some of which are created by exploding other notes), I need to keep track of where they have come from.
Have you tried to invoke the
stamp() action in the
Action field of the Explode dialog?
Edit: Tweak this suggestion to include @mwra’s suggestion of the Exploded Notes prototype.
Thank you. I had missed that possibility, though I would rather a way to make sure that it happens every time rather than having to remember to type that in each time. When I get a moment I shall try this, and see whether TB remembers what I put in here.
The last seems closest to your use. You can also add (if not already added from using Explode) the ‘Exploded Notes’ prototype†. The prototype’s $OnAdd equates to the ‘action’ box mentioned in the post above; i.e. both approaches do the same thing. As the ‘action’ input on the Explode pop-over is a small box, if you’ve more than short code using the prototype’s OnAdd Inspector my help be able to see/review your code.
Do think through what grandparent is in each case. In the scenario above (in Inspector or Explode dialog)
grandparent will be the note that is being Exploded, as the new notes are the children of the ‘exploded notes’ container created by the explode.
†. Observe that the container created by Explode is called ‘exploded notes’ and the prototype is use is called ‘Exploded Notes’ (my bolding). The difference in capitalisation so as to allow the two different things to be addressed discretely (by $Name).
Then look into using your existing approach via the prototype (see my post above). As long as the prototype remains in your TBX document, the prototype’s $OnAdd (be in a stamp call or literal code) will run on all new Explode-created notes.
Of course, if you do different Explodes needing different code run on differently-sourced new items, you’ll need to expand the code logic a bit, but the same principle holds in ensuring some code gets run.
If I’m not mistaken, it feels like you’re looking for a feature request that seems similar to what I’d like to see. I’d love it if there was a wat for TBX to remember my explode code. Per Paul’s comment, perhaps the easiest way to do this would be leveraging stamps. We could ask @eastgate for a dropdown to be able to select a stamp. Perhaps the first item in this drop dropdown could have “Save as Stamp” option. If you selected a stamp it would insert
stamp(STAMPNAME) into the Action field. Just an idea.
Thanks for these responses. From Mark’s response, the $OnAdd route in the prototype seems the way to go, and I shall try that as soon as I can get round to it. I also appreciate being warned about the different capitalisations of exploded notes as I had not noticed this. Useful trick.
This is superfluous, I believe. The Action panel can accept the
stamp() action. Also, from a UX perspective, assigning a Stamp (via a dropdown) concurrent with assigning actions (via the Action panel) could lead to difficult-to-diagnose conflicts.
It is about easy of use, i.e., not having to manually re-enter code or remember the name of a stamp when you want to use it.
Putting the stamp in $OnAdd in the prototype for exploded notes does what I wanted. Thanks to everyone for their advice.
In talking with @mwra, I/we think a nice addition would be to have a “saveable explode” option that saves the entire set of explode dialog options, not just the action code. Now, this would be a nice addition. Something for @eastgate to explore. As a user I could simply select from a drop-down my saved explodes.