I was experimenting with running agents to automated linking and I linked very one of my notes to 48 other notes. Ugh. See attached, so many outbound links.
I think I can use unlinkFrom on the notes, one at a time, or in a group, but I canât seem to get it to work. I tried to make it work with one note as a test and it just wonât work. Can someone help?
Anytime you find a repeatable crash â especially when doing something unusual like deleting lots of links very quickly! â send a crash log and sample file to tinderbox@eastgate.com! That will help the folk who come next.
Easy solution: duplicate the note. The duplicate wonât have any of the links, but has the same text and attribute values. Delete the original.
I think @eastgateâs dupe/delete answer probably solves the immediate problem, but Iâll try and answer the action code aspect.
To unlink an object (note or agent) from other object, i.e. remove outbound links, you need unlinkTo(). As the article states to unlink everything (outbound) use:
unlinkTo("all");
If you only want to remove links of a particular type, e.g. âBenefitâ;
unlinkTo("all","Benefit");
if note A links to note B with links of type âBenefitâ and âExampleâ:
unlinkTo("B","Benefit");
would result in only one remaining link from a to B, of type âExampleâ
On a wider point, the opening problem has hopefully shown why advice is to test things on small test files first and only apply them in a larger context once your are confident that you understand the process. Working on small tests makes it much easier to see what is happening and only leaves issues of scale or interference from other code in your app to deal with.
If I am going to do something in a document that might have uncertain results, Iâll duplicate the document and try there first. Easy to throw away the test document than to repair a major mess in my main document.
Another useful aspect of making a twist is because you need to make necessary/sufficient test data, even that small amount of customisation is often a prompt to (re-)consider choices, e.g. prototype naming, number/type of new user attributes, custom link types, etc.
In hindsight, if got as much benefit from those reflections if not more as from the original intent of a small safe test. Test docs are useful.
Testing a lot, with the same customisation? Make a âstarterâ fileâ and add it as a favourites file. That way you can crack open a new-but-customised file for next to no effort.