FACTORY Optional Statement

This article contains the following topics:
This article contains the following topics:
Defines access to the object, like its relation attribute, a common name, the security group that can access it, the type of lists produced, and how those lists can be sorted. If omitted, the object is treated according to default specifications.
Syntax (FACTORY Optional Statement)
FACTORY [fac_name]{ [REL_ATTR name ;] [COMMON_NAME name ;] [FUNCTION_GROUP name ;] [DISPLAY_NAME name ;] [STANDARD_LISTS { [SORT_BY index_att ;] [FETCH fetch_att ;] [WHERE string ;] [MLIST ON|OFF;] [RLIST ON|OFF;] } ;] };
Arguments (FACTORY Optional Statement)
  • fac_name
    The name of the factory that initiates the object. Specify this only if it is different from the name of the object. For example, the cnt object has four factories: cnt, cst, agt, grp.
Optional Statements (FACTORY Optional Statement)
At least one of these optional statements must be specified:
    Identifies the attribute that will represent this object when it is referenced (used as an SREL) by another object. Here is an example:
    REL_ATTR id ;
  • REL_ATTR name, srel_name (attr1,attr2,…)
    Identifies the attributes that will represent this object when it is referenced (used as an “named” SREL) by another object. where
    • srel_name
      matches the "named" SREL name
    • attr1
      is mapped to by the first attribute in the "named" SREL attribute list.
    • attr2
      is mapped to by the second attribute in the "named" SREL attribute list.
    Defines an external name for the table.
    DISPLAY_NAME "Call Request" ;
    Defines the attribute to be displayed in drop-down lists or when the user double-clicks a field, as well as when the tag does not specify a complete attribute. In the first example, the value for sym appears on the window instead of the value for the REL_ATTR. The second example allows you to specify a tag as cr.customer instead of cr.customer.combo_name.
    COMMON_NAME sym ; COMMON_NAME combo_name ;
    Indicates which security access group is permitted to access the object. For example:
    FUNCTION_GROUP "admin" ;
    Creates lists of objects that are kept in a cache and can be displayed on list or select windows. The parameters determine whether the lists are master lists or restricted lists, whether the objects included in the list must meet specified conditions, how the lists can be sorted, and what additional attributes are stored. Refer STANDARD_LISTS Optional Statement for the description of the syntax.
Example (FACTORY Optional Statement)
This example defines access to the object. A master list is produced. It can be sorted according to the values in the object’s sym and code attributes. When first displayed, it is sorted according to the values in the sym attribute by default. When referenced by another object, this object is represented by the code attribute. When displayed in a window, the value for sym appears instead of the value for code. Only users in the admin security group can accessed it:
ATTRIBUTES Optional Statement
The optional statement on the OBJECT statement that defines the properties of the object.
ATTRIBUTES [table_name]{ att_name [field_name] value_type [access_type[status_type][DISPLAY_NAME string]] { [ON_NEW DEFAULT|SET value|NOW ;] [ON_CI DEFAULT|SET value|NOW ;] [ON_DB_INIT DEFAULT|SET value|NOW ;];]};]
  • table_name
    The name of the table in the database that stores the values associated with the attributes in the object. If the table name is not specified, the
    in the OBJECT statement is used.
  • att_name
    The name of the attribute. Each attribute usually maps to a field (column) in the database table.
  • field_name
    The name of the field in the database table or LOCAL if the attribute does not map to a field or DERIVED (derived-expr) if the attribute is derived from other attributes. If neither LOCAL, DERIVED nor a field name is specified, the name of the field is assumed to be the same as the name of the attribute.
    A variable declared as DERIVED is constructed only when its value is retrieved. The operand of DERIVED contains a list of attribute names and string constants separated by spaces. All attributes in a derived value must be simple values (that is, they cannot be xRELs), and should be declared prior to the derived variable. The derived attribute's value is the concatenation of the values of its constituent values.
    String constants within a derived expression may contain references to environment variables in the one of the forms:
    Such specifications are replaced with the value of the environment variable at domsrvr startup time. The #pattern operand is optional. If provided, it is treated as a regular expression, and replaced wherever it appears in the environment variable's value. The #replacement operand defaults to null if not specified. Because # is a fixed delimeter, the pattern cannot contain a # symbol. There are no restrictions on the use of derived attributes in other messages. They behave in same way as standard attributes. A hotlink for a derived attribute fires whenever any of the attributes from which it is built changes.
  • value_type
    Identifies the data type of the attribute’s value as:
    • DOUBLE
    • STRING [
    • UUID
    • DATE
    • SREL
    • SREL { ob2_name_name srel_name ( name, name2, ... ) }
    If STRING is specified, the size can be specified in an integer following STRING. If no size is specified, the value in the database is used.
    UUID is 16 bytes of binary data that is used as a unique identifier for certain database records.
    SREL refers the attribute to another object. If SREL is specified,
    must be specified to identify the object that the attribute refers to.
    srel_name specifies a "named" SREL. Like a "simple" SREL, a "named" is a type of MAJIC OBJECT attribute that represents a single relation, which uniquely identifies a row in another table (ob2_name). A "simple" SREL attribute normally maps to the "id" field in another table, however a "named" SREL maps two or more attributes ( name, name2, … ) to two or more attributes in the referenced table that uniquely identify a row in the referenced table.
  • access_type
    Defines access to the attribute. Valid values are:
Cannot be changed
Read/write access (the default)
Can be written only when the object is created, before the object is saved
  • status_type
    Indicates the status of the attribute as:
    • NOT_REQUIRED (the default)
  • DISPLAY_NAME string
    Specifies a string to be used in place of the attribute name in messages concerning this attribute, such as"required attribute missing"
ON Statements
Use one of these only when
    Indicates to set the value of an attribute when the object is being created for the first time:
Changes a null current value to
or NOW.
Changes any current value to
or NOW.
Specifies a numeric value or a string value, depending on the data type of the attribute.
Specify this if the attribute is of type DATE; it sets the attribute to the current date and time.
In the following example, 90 is the value set as a default when the object is created:
    Indicates to set the value of an attribute when the attribute is being checked into the database. See the description of each parameter for ON_NEW.
    Indicates to set the value of an attribute when the attribute is being instantiated from the database. See the description of each parameter for ON_NEW.
This example defines attributes with names like start_date whose values are stored in fields like nlh_start in the Notify_Log_Header table in the database. The field names are followed by each attribute’s data type. Optional parameters define access to some of the attributes, indicate that the attribute is required, and tell when to set the value of some of the attributes to the current date and time.
For example, an attribute named last_mod is defined; its value is set to the current date and time when the attribute is checked into the database. An attribute named contact is also defined; its value is a single relation stored in database field nlh_c_addressee. The object referred to is cnt:
ATTRIBUTES Notify_Log_Header { start_date nlh_start DATE WRITE_NEW {ON_NEW DEFAULT NOW;} ; last_mod DATE {ON_CI SET NOW ;} ; msg_hdr nlh_hdr STRING 20 WRITE_NEW ; msg_text nlh_msg STRING WRITE_NEW ; msg_ack nlh_user_ack STRING ; contact nlh_c_addressee SREL cnt WRITE_NEW ; notify_method nlh_cm_method INTEGER WRITE_NEW ; activity_notify nlh_transition INTEGER WRITE_NEW ; pri_event nlh_pri INTEGER WRITE_NEW ; notify_type nlh_type INTEGER WRITE_NEW ; ack_time nlh_ack_time DURATION ; status nlh_status INTEGER REQUIRED ; end_date nlh_end DATE {ON_NEW DEFAULT NOW ;} ;