Caché ObjectScript Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns the value of the specified class parameter.
class Optional — Either a class name or an object reference (OREF) to a class instance. If omitted, uses the object reference of the current class instance. When omitted, you must specify the placeholder comma.
parameter The name of a parameter. An expression which evaluates to a string. The value of the string must match the name of an existing parameter of the class identified by class.
$PARAMETER returns the value of a specified class parameter. $PARAMETER can look up this parameter in the current class context or in a specified class context. You can specify a class name as a quoted string, specify an OREF, or omit the class parameter and take as default the current instance (see $THIS). Specifying class is optional; specifying the comma separator is mandatory.
For example:
  WRITE $PARAMETER("%Library.Boolean","XSDTYPE")
There are several ways to return the value of a parameter using object syntax, as shown in the following example:
  ZNSPACE "Samples"
  WRITE "ObjectScript function:",!
  WRITE !,"class parameter:",!
  WRITE ##class(Sample.Person).#EXTENTQUERYSPEC
  WRITE !,"instance parameter:",!
  SET myinst=##class(Sample.Person).%New()
  WRITE myinst.%GetParameter("EXTENTQUERYSPEC")
  WRITE !,"instance parameter:",!
Invalid Values
The following example specifies class names and returns the class default values for the XMLTYPE and XSDTYPE parameters:
The following example specifies an OREF and returns the value of the XMLTYPE parameter for this instance:
  SET oref=##class(%SYSTEM.Task).%New()
The following example returns a system parameter using $PARAMETER syntax and using class syntax:
  WRITE ##class(%SYSTEM.SQL).#%RandomSig
See Also