2.20 :has()

With this method it can be queried dynamically at runtime whether the object has a certain user-defined attribute or user-defined method.

The method cannot be used to query the existence of predefined attributes and methods.

Definition

boolean :has
(
      anyvalue MethodOrAttr input
  { , anyvalue Index        input }
)

Parameters

anyvalue MethodOrAttr input
The user-defined attribute or user-defined method whose existence shall be checked.
anyvalue Index input
For user-defined attributes, this optional parameter is used to query whether the attribute is available and if it can be accessed with the indicated index.

Return value

true
The attribute or method is available at the object.
false
The attribute or method is not available at the object.

Objects With This Method

Example

dialog Example
record Rec
{
  string String;
  rule void Method {}
}
 
on dialog start
{
  print Rec:has(:Method);  // returns true
  print Rec:has(.String);  // returns true
  print Rec:has(:Print);   // returns false
  print Rec:has(.Data);    // returns false
}