This version is out of date, covering development from v9.0.0 to v9.3.0. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

linkFrom(["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

 


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

This creates an untitled type basic link from item to the current note (i.e. an inbound link).

The item parameter must be quoted unless an attribute reference, e.g. "Some note" vs $MyString. Ways to define item.

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

linkType (string). Optionally, instead of an 'untitled' link the link can be of linkType type. An untitled type link can be explicitly specified using the string "*untitled". Unlike unlinking, this argument may only contain a single link type value.

Both arguments are evaluated. This operator does not require a left-side argument, simply calling effects a result. A new link will not be created if a link of the stated type already exists.

Examples

Linking to a note "Some note":

No link type: linkFrom("Some note") 

Link type 'agree': linkFrom("Some note","agree"); 

Linking to the first child

linkFrom("child"); 

linkFrom("child","agree"); 

Relevant similar operators: linkTo, unlinkTo, 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:

linkFrom("Example 1 (a test)"); 

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

linkFrom("2+2") 

will link from the note named '2+2' but if no match will look for a note named '4'.

This function can link from an alias as opposed to an original (if the logical choice) and can accept a group scope.

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 linkFromOriginal() code will ensure any link created 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 : linkFrom(["item|group"][,"linkType"])