Resetting(Remove) Basic Links? Resetting(Remove) Text Links with a stamp(s)?

How would I go about creating stamp(s) to reset my Basic Links to and from a note?
To extend it further, creating a stamp to reset my Text Links to and from a note?

Use case, let’s say I have an older note on a concept I was trying to develop and over time, I gain greater insight and decide my initial map was incorrect and I want to start over.

Is there a way I can select all my notes (or selected notes) and reset my links: Basic and Text?

Thanks in advance
Tom

I’m not sure of what you imply by ‘reset’. But a few pointers:

So you can delete all in- or out-bound links for both basic and text links. For creating links you can only create in- or -out-bound basic links.

Thanks Mark, by resetting I am meaning I want to delete all my basic and text links to and from the selected notes.

So thank you for the suggestion:

I am still a bit unclear how to use this to delete all basic and text links if I select a number of notes and want to use a stamp.

How would I use the above in a stamp? Generally, if I want to reset $Color for example, I use $Color=; in a stamp. Not sure how I would use the unlinkTo and unlinkFrom in the stamp.

I am certain it is super easy, but I can’t seem to put what I want to do into a stamp action code.

Thanks in advance,
Tom

When you stamp a note, the stamp action runs on each selected note, once. The same action occurs whether your stamp one note or many. So the number of items selected is a diversion.

By “all basic and text links”, I assume you mean outbound links form the selected note to other note(s). Hint, read the first paragraph of the linked articles above as they describe this aspect explicitly. If not sure, please quote the text that is not clear. Spoiler (click to reveal answer): see unlinkTo().

Next, having selected your method, you need to define a group designator. Look at the list on the latter page. Which of the listed terms do you think would define all the notes linked from this one? You can click any item for a full description. Spoiler (click to reveal answer): did you try all?.

Lastly, the linking operators tend to have an optional link type input that allows your to filter for particular link type(s) only. Omitting this argument implies all link types, so you don’t need this argument in your stamp. Testing, I discovered a bug! You need to use `“*” as the second argument (N.B. docs not yet updated).

I’ve constructed the above answer in this way as the answers are there, but you will often have to follow links if you don’t already understand the link types. In this case, starting from the aTbRef action code list don’t think you’d need to read many aTbRef pages.

It simply isn’t feasible to answer every question as a worked example (and obvious questions are subjective).

Hopefully, I’ve guided you to an answer in a manner that will help you next time with a similar but different occasion. If not, and there’s some ambiguity I’ve completely missed, do say. The latter is something that would need addressing at source.

Suggested stamp code: spoiler (click to reveal answer): unlinkTo(all);.

2 Likes

Would the stamp code

unlinkFrom(all,"*");

Also remove the link between the note and its prototype? I’ve run it a couple of times, and all displayed attributes disappear, and only reappear when I reapply the relevant prototype to the note. Is there a way to get around it… sort of like unlinkFrom all …except the prototype?

1 Like

Yes, because it is a link, although in most cases not treated as one. Indeed, until testing, I’d assumed it would not as setting $Prototype is the normal way of doing this. But, that gives a hint at how to root around the issue. this works in v9.5.2:

var:string vPrototype = $Prototype;
unlinkFrom(all,"*");
$Prototype = vPrototype;

Note: if you have an onLink action for the ‘prototype’ link type it would fire as the prototype link is re-made.

1 Like

In the future, unlinkFrom and unlinkTo will spare prototype links. Until then, Mark Anderson’s workaround is good!

3 Likes

Great! Thank you…

Thank you!

1 Like