Operator Type:
Operator Scope of Action:
Operator Purpose:
Data Type Returned:
Operator First Added:
Operator in Current Baseline:
Operator Last Altered:
Operator Uses Scoped Arguments:
Operator Has Optional Arguments:
Function [other Function type actions]
Group [operators of similar scope]
Linking [other Linking operators]
success boolean
v4.6.0
Baseline
10.0.0
unlinkFrom(scope[, linkTypeStr])
This removes all basic links from scope to the current note (i.e. inbound links). unlinkFrom() does not delete prototype links.
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.
scope argument
The scope argument must be quoted unless an attribute reference, e.g. "Some note"
vs. $MyString
. Ways to define scope. Note that here, unlike other scope uses, $Path can not be used.
scope may be group scoped including use of group designators and operators like find,() collect and links().
linkTypeStr argument
linkTypeStr (string). Optionally, link deletion can be constrained to one type supplied as literal string value for linkTypeStr:
- If no linkTypeStr argument is supplied, only untitled (i.e. no link type) links are deleted.
- If a valid link type name, e.g. "agree", is supplied only links of the specified type are deleted.
- To delete all links of any type or none use the wildcard value "*" (an asterisk). Also note:
- This method does not affect prototype links.
- This wildcard linkTypeStr option only applies to unlinking, and not to linking).
From v10.0.0, linkTypeStr is evaluated as a literal string (previously a pattern match was undertaken).
Examples
Unlinking from a note "Some note":
all link types: unlinkFrom("Some note");
only link type 'agree': unlinkFrom("Some note","agree");
either of 2 link types: unlinkFrom("Some note", "example|disagree");
Unlinking the first child (via a designator):
unlinkFrom(child);
unlinkFrom(child,"agree");
See further below for group-scope references.
Relevant similar operators: linkTo, linkFrom, unlinkTo.
Use of this action does not shift note focus; in addition if scope contains operators (brackets, plus, minus, etc.) Tinderbox will first look for a match to the literal scope string and only if there is no match will the app try evaluating to operators and testing the resulting string. For example:
unlinkFrom("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:
unlinkFrom("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 unlinkFromOriginal() code will ensure any link deleted is between two original notes regardless of whether an alias is the context of execution of the code.
See also—notes linking to here: