Operator Scope of Action:
Operator First Added:
inheritsFrom(), is Boolean
true if a specific prototype (note) is used by a note, either directly or through other prototypes. In a query, or find(), all notes are tested. In an action context (rule, edict, agent action, OnAdd, expression, etc.) only the current note (this) is evaluated. To query the document for notes inheriting from prototype 'pEvent', use the query term:
It is possible to test, via an action, the inheritance of a different note using the second parameter. Thus to test if 'Note B' inherits from prototype 'pTask':
For example, suppose prototype 'pFlower' has the prototype 'pPlant', and note 'Rose' uses the prototype 'pFlower'. Then
is true for both pFlower and pPlant.
is true for Rose, but false for pPlant.
N.B. note that the stated prototype is also included in the items testing true. This makes sense if actual notes in the document are prototypes, as opposed to using only deliberate 'non-content' prototypes. To filter the latter, and exclude all prototype notes, use a query like:
inheritsFrom("pFlower") & $IsPrototype==false
You can also write an offset test so note 'Rose' can test if note 'Camelia' uses prototype 'pFlower':
This returns true if 'Camelia' inhertis from that prototype. Or, 'Rose' might want to check if its parent uses that prototype: