Tinderbox Forum

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,"*");

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: