Tinderbox 7 Icon

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


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Group   [operators of similar scope]

 Linking   [other Linking operators]

 Baseline

 


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

This removes all basic links to item from the current note (i.e. outbound links).

The item parameter must be quoted unless an attribute reference, e.g. "Some note" vs $MyString. Ways to define item - but note that here, unlike other item uses, $Path can not be used.

The item may be group scoped including use of group designators and operators like find,() collect() and links().

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.

Both arguments are evaluated. This operator does not require a left-side argument, simply calling effects a result. No change occurs if the described link does not exist.

Unlinking a note "Some note":

all link types: unlinkTo("Some note") 

only link type 'agree': unlinkTo("Some note","agree") 

either of 2 link types: unlinkTo("Some note", "agree|disagree") 

Matching the first child

unlinkTo("child") 

unlinkTo("child","agree") 

See further below for group-scope references.

Relevant similar operators: linkTo, linkFrom, unlinkFrom.

Use of this action does not shift note focus; in addition if item contains operators (brackets, plus, minus, etc.) Tinderbox will first look for a match to the literal item string and only if there is no match will the app try evaluating to operators and testing the resulting string. For example:

unlinkTo("Example 1 (a test)") 

will unlink the note named 'Example 1 (a test)'. If no note matches this string, Tinderbox will attempt to evaluate the string. Thus for:

unlinkTo("2+2") 

will unlink the note named '2+2' but if there is no match Tinderbox will look for a note named '4'.

This function can unlink an alias as opposed to an original (if the logical choice) and can also accept a group scope. An example of group scope is the following code that could be used in a rule or stamp to remove in/bound footnote links from one or more selected notes. Use of the 'all' designator removes the need to know the name of the notes for which the selection are footnotes:

unlinkFrom("all","note");unlinkTo("all","note+"); 

Use in agents

Beware that the action is working on an alias of the current note and note the current note itself. As originals and aliases support discrete basic links this function should not generally be used in an agent. The best way to use the function is by using a prototype and apply a $Rule to it thus running the code in all notes using the prototype.

An alternative unlinkToOriginal() code will ensure any link deleted is between two original notes regardless of whether an alias is the context of execution of the code.



A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : unlinkTo("[item|group]"[,linkType])