I want to run a stamp against a set. This stamp will perform to operations: 1. create a note for each item in the set, and the 2. link the newly created note to another note.
//Create notes from set
$MySet.each(x){
var vContainer=$Path;
var vNote="GAP:"+x;
create(vContainer,vNote);
};
//Link newly created note to another note.
var x=$Name;
var vFeature="Ftr- "+x;
linkFromOriginal(that)(vFeature,"Gap");
I have step 1 working. What I can’t figure out how to do is have Tinderbox give the newly created note focus to run step 2. Is there a “that” designator syntax that I can use?
Not tested but, don’t overlook that create() returns a note’s path (if successfully created):
//Create notes from set
$MySet.each(x){
var vContainer=$Path;
var vNote="GAP:"+x;
var:list vPathList;
var vPathList += create(vContainer,vNote);
};
//Link newly created note to another note.
vPathList.each(aPath){
va:string vFeature="Ftr- "+ $Name;
linkFromOriginal(aPath,vFeature);
};
Hopefully that get’s moving forwards, though I can’t tell from the second stage what note links to what note.
OK, the first loop gives yo the paths of the new note(s). Do they linkTo() or linkFrom() another note and if so what is the name of that note. All they all being linked with the same note, or with a different not in each case.
There’s not enough info in the opening description to tell. As a result, my pseudo-code had to make some (wrong!) assumptions. Perhaps a diagram showing the output and link direction might help. Is the new note the target or the destination, etc.?
I have a note with a bunch of values in a set. I use these value in my Stamp to create children (“that”) from “this” note.
I then want this Stamp to also link each of the newly created children (the “thats”) to a different note note “something else” (the something else is the name of the child with a prefix, it is standard pattern).
So, my problem is, I don’t know how to tell “this” to link “that” to something else.
I’m pretty sure this can be done, but I can’t figure out how to help Tinderbox give the newly create note the focus for the application of the link action.
How are the source and destination related, capturing that is key to the task. You can then use two nested List loops (avoid Sets as you don’t want arbitrary re-sorting or make a dictionary of source as key, destination as value. then you can iterate the dictionary keys and link each source to its destination.
This is fantastic! Works perfectly. Blindingly obviously. Thx.
Here is the stamp I created.
//Create notes from set
$MySet.each(x){
var vContainer=$Path;
var vNote="GAP:"+x;
create(vContainer,vNote);
//Link newly created note to another note.
var vFeature="Ftr- "+x;
createLink(vFeature,vNote,"Gap");
};