Operator Scope of Action:
Operator First Added:
Operator Last Altered:
Operator Has Optional Arguments:
Function [other Function type actions]
Item [operators of similar scope]
Query Boolean [other Query Boolean operators]
As at baseline
inheritsFrom(), is Boolean
true if a specific prototypeStr (note) is used by a note, either directly or through other prototypes. For a direct inheritance, the value of $Prototype can be checked but inheritsFrom() allows checking of inheritance via multiple prototypes. Where a note X inherits from a prototype A but the latter itself uses a prototype B, inheritsFrom() allows testing if X inherits indirectly from B. As such inheritance occurs via A, it is otherwise difficult to test such inheritance. This is a specialist operator unlikely to be used except where prototypes themselves use 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 optional second scoping argument item. 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
true for both pFlower and pPlant.
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':
true if 'Camelia' inherits from that prototype. Or, 'Rose' might want to check if its parent uses that prototype: