The designator this describes the current note (i.e. the note currently in focus). The focus of this can vary slightly by context:
- in $Rule & $Edict: the note whose rule is running
- in $OnAdd/OnRemove: the note that is being added/removed. In context, an attribute with no designator thus refers to the note running the action
- in $AgentQuery: the note that is being examined
- in $AgentAction: the alias that is being examined
- in find(), collect(), etc: the note that is being examined
Beware of nesting changing the context. Consider the following rule:
$Text=find($MyString==$Name(this))
Although the overall context is a rule, the rule contains a find, which in turn holds the 'this' designator. Therefore in the above example 'this' is evaluated in the context of the nested find() and not as in a simple $Rule. The problem is resolved by using a different designator: see 'that'.