Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Item [operators of similar scope]
Linking [other Linking operators]
9.1.0
eachLink(LoopVar){}
New to v9.1.0, this operator examines each link for the current note, either inbound or outbound; prototype links are excluded. The local, user-set, variable LoopVar is bound to a dictionary-type object of per-link properties, including:
- source ($Path of source object)
- destination ($Path of destination object)
- type
- class
- title
- target
- url
- comment
- anchor (for text links, the links' anchor text within $Text)
The above features are described for the Browse Links dialog.
eachLink() is read-only: any changes to these variables values are not (yet) recorded as changes to the link.
Example:
For example, does this note have a link of type "agree"?
function isAgreeable(){
eachLink(aLink) {
if(aLink["type"]=="agree"){
return true;
};
};
return false;
};
Or, to count the number of links from this note to tasks:
function linkedTasks(){
var:number vCount=0;
eachLink(aLink){
if($Prototype(aLink["destination"])=="Task"){
vCount += 1;
};
};
return count;
};
The examples use line breaks for clarity, and the last example may equally well be stored and used in the form:
function linkedTasks(){var:number vCount=0;eachLink(aLink){if($Prototype(aLink["destination"])=="Task"){vCount+=1;};};return count;};