Removing links from a note

If I wanted to remove links from a note, how would I go bout that? For example, If I wanted all links from 2011 to be deleted. I tried unlinkToOriginal(), but I appear to be doing something wrong.

Select the note. Open the Roadmap from the View menu or contextual menu. Select the link to destroy. Press Delete. (The Browse Links popover also can be used for this.)

This is a destructive action that cannot be undone.

Hi there, yes, this is a good idea and works for one link at a time. I guess I should have been clearer with my question. How do I programmatically unlink many links, e.g. 20 or more, to or form a note? Doing 20 or more not 20 more notes is a lot one at a time. Iā€™d like to find a way to automate this a bit. I figured it out how to do it with a Stamp, but not an agent. I guess I have to figure out the context, think about the action from Tinderboxā€™s view. That will help. :wink:

Have you tried unlinkTo()/linkFrom()/unlinkFrom()/unlinkFromOriginal()?

Iā€™ve tested

unlinkFrom(all,"[type]");

and it works for a selected note. So an agent that queries for the notes you want to affect should work with that sort of action. You might need to cycle through all link types in use. But, in an agent use

unlinkFromOriginal(all,"[type]");

The action means ā€œunlink this note for links of type ā€œ[type]ā€ for all notes that link to itā€.

I suspect your case is probably messier than than posts indicate, so this is not guaranteed to solve your problem. As @mwra suggests, these are the right action codes ā€“ itā€™s now a matter of the right agent.

Cool, thanks for your help, guys. Ya per the stamp visual above I have been trying the unlinkTo and from, but clearly, Iā€™m not getting the context right in the agent. I got it working at the step level. Iā€™ll playing around with other options. Eventually, Iā€™ll figure it out. :slight_smile:

Ok, I give up. Here is my fine. TBXUC - Rendering Spreadsheet.tbx (847.4 KB) What Iā€™m trying to do is have ā€œaUnSectorā€ remove all the inbound links to the note ā€œnodeā€ government. I know I can do this one by one and with a stamp, but canā€™t seem to get the agent to work.

Your file has a link type with no name ā€“ check the links inspector ā€“ and most of the inbound links for ā€œgovernmentā€ have that link type. The file also seems to be corrupt ā€“ when I try to apply an unLink stamp, or agent, Tinderbox crashes on me.

when I try to apply an unLink stamp, or agent, Tinderbox crashes on me.

If you have a minute. it would be useful to see the document and the crash log.

The document is the one @satikusala provided in his post above.

OK. I opened that document. The stamp named ā€œCapitalizeā€ has the action:

unlinkTo(ā€œgovernmentā€)

In outline view, I selected the note ā€œMassachusetts Governmentā€, which is linked to ā€œgovernmentā€, and then used the stamp ā€œCapitalizeā€. The link was deleted, and Tinderbox didnā€™t crash.

I sent you the crash logs. Makes no difference to me if the crashes can be reproduced.

Of course not, but in this case ā€“ as so often! ā€“ the crash log contains a vital clue. The crash occurs during map drawing, and so we know that you were in map view, while I was working in outline view.

The difficultly likely arises when an action deletes a link while the map view is drawing the link. Clearly, that can be tricky! In any case, I know where to look.

1 Like

As noted above, unlinking with the Stamp works fine. What Iā€™d like to know is how/if this can be done through an agent. Thanks.

The same action should work in an agent. As explained above, this in an agent is bound to the alias the agent is making, so you want to unlink the original.

Thanks. Iā€™ll keep playing and try to figure something out.

@satikusala: I think I have a solution. I wasnā€™t paying attention to the description of unlinkFrom().

unlinkFrom(["item|group"][,"linkType"])

in particular this:

linkType (string). Optionally, link deletion can be constrained to one or more types supplied in linkType . The argument allows simple regular expressions; ā€œdisagree|exampleā€ would delete links of type ā€˜disagreeā€™ and ā€˜exampleā€™ but leave others untouched.

So, when I try this in a stamp (would work in an agent)

unlinkFrom(all,"*");

2020-12-28_07-32-31 (1)

It works ā€“ because "*" is a regular expression that captures all link types.

Sorry for not paying attention earlier ā€“ in Tinderbox it is the simplest, most obvious errors that are the hardest to find.

(And to confirm again several times today, unlinkFrom() or ```unlinkTo()``,` when used on a map, kills Tinderbox.)

Thanks, Paul. I like the refined stamp, and stamps certainly work. I love the animated gif idea. SUPER SMART!

Unfortunately, I still canā€™t seem to get this to work with an agent. Here is a LONG animated gif that shows that the stamp works but the agent does not seem to work. Any chance in your sample file you can try an agent to see if you can get it to work.

Stamp works:

The agent does not seem to work (Iā€™ve tried To and From)

I tested and this agent works for me:

Screenshot of Tinderbox (12-28-20, 9-11-15 AM)

Note that in an agent you need to use unlinkFromOriginal, and in the syntax unlinkFromOriginal(["item|group"][,"linkType"]) you can leave the first argument (ā€œitem|groupā€) blank since the scope is already determined by the agent.

Thanks. Still no joy. Iā€™ll figure it out eventually. :wink: