Business Process and Data Transformation Language Reference
<property>
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Define a property within the <context> element for a business process.
Synopsis
<property name='Test' type='%Integer' initialexpression='342' >
  <parameters>
    <parameter name='MAXVAL' value='1000' />
  </parameters>
</property>
Details
Attribute or Element Description Value
name attribute Required. The name of this property. It must be a valid property name. A string of one or more characters.
type attribute Optional. The name of the class that specifies the type of this property. It can be a data type class (%String) or a serial or persistent class. A string of one or more characters giving the name of the class.
initialexpression attribute Optional. This expression is evaluated to provide a default value for the property. The expression must use the scripting language specified by the containing <process> element, either Caché Basic or ObjectScript. An expression that provides a valid value for the property. See the discussion below.
instantiate attribute Optional. Acts as a “create” flag for the property. If not specified, the default is 0 (do not create). 1 (create) or 0 (do not create)
collection attribute Optional. If present, specifies that this property is a collection of a certain type. A literal string, either “list”, “array”, “binarystream”, or “characterstream”
<parameters> An optional <parameters> element may appear. Inside the <parameters> container, zero or more <parameter> elements may appear. Each <parameter> element defines one data type parameter for the property by providing a parameter name and value. For valid names and values, see Parameters section in the chapter “Data Types” in Using Caché Objects.  
Description
The <property> element defines a property within the business process execution context.
The life cycle of a business process requires it to have certain state information saved to disk and restored from disk, whenever the business process suspends or resumes execution. A BPL business process supports the business process life cycle with a group of variables known as the execution context.
The execution context variables include the objects called context, request, response, callrequest, callresponse and process; the integer value synctimedout; the collection syncresponses; and the %Status value status. Each variable has a specific purpose, as described in documentation for the <assign>, <call>, <code>, and <sync> elements.
Most of the execution context variables are automatically defined for the business process. The exception to this rule is the general-purpose container object called context, which a BPL developer must define. Any value that you want to be persistent and available everywhere within the business process should be declared as a property of the context object. You can do this by providing <context> and <property> elements at the beginning of the BPL document. Each <property> element defines one property of the context object.
A <property> element must provide a name.
For non-collection properties, the initialexpression and instantiate attributes dictate how the object will be initialized. If the instantiate attribute has the integer value 1 (true), then a call to “new” the object will be generated. If an initialexpression attribute is specified as well, then the result of this expression will be assigned to the object.
The instantiate attribute should be used to initialize properties that can be instantiated, whereas the initialexpression attribute should be used to initialize data type classes such as %String. For string values, be sure to provide the string quotes wrapped inside another set of quotes. That is: initialexpression='"hello"' to set an initial string value of "hello".
If the collection attribute is set (“list”, “array”, “binarystream”, or “characterstream”) the property is automatically instantiated as a collection of that type.
The following example shows a set of <property> elements within the <context> element at the beginning of a business process:
<process request="Demo.Loan.Msg.Application" response="Demo.Loan.Msg.Approval">
  <context>
    <property name="BankName" type="%String"
              initialexpression="BankOfMomAndDad" />
    <property name="IsApproved" type="%Boolean"/>
    <property name="InterestRate" type="%Numeric"/>
    <property name="TheResults"
              type="Demo.Loan.Msg.Approval"
              collection="list"/>
    <property name="Iterator" type="%String"/>
    <property name="ThisResult" type="Demo.Loan.Msg.Approval"/>
  </context>
  ...
</process>
Each <property> element defines the name and data type for a property. For a list of available data type classes, see Parameters in the chapter “Data Types” in Using Caché Objects. <property> may assign an initial value by providing an initialexpression attribute. Alternatively, you may assign values during business process execution, using the <assign> element.
See Also
<parameters>