Previous Topic: Types of StatementsNext Topic: ATTRIBUTES Optional Statement


OBJECT Statement

Defines a business object.

Syntax

OBJECT obj_name {
    [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 ;]} ;]};]


    [FACTORY [fac_name]{
        [REL_ATTR name ;]
        [COMMON_NAME name ;]
	 [DISPLAY_NAME name ;]
        [FUNCTION_GROUP name ;]
        [STANDARD_LISTS {
           [SORT_BY index_att ;]
           [FETCH fetch_att ;]
           [WHERE string ;]
           [MLIST ON|OFF;]
           [RLIST ON|OFF;] } ;]};]
};

Arguments

obj_name

The object’s name (for example, cnt for contact or cr for request).

Optional Statements

Either ATTRIBUTES or FACTORY must be specified. Both can be specified.

ATTRIBUTES [table_name] { }

Defines the properties of the object. Most attributes map to a field (column) in a database table. The ATTRIBUTES Optional Statement describes its syntax.

FACTORY [fac_name] { }

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. The FACTORY Optional Statement describes its syntax.

Example

This example defines an object named ctp. The ATTRIBUTES statement defines attributes named sym, delete_flag, and description whose values are stored in the Contact_Type table in the database. The FACTORY statement creates a master list of objects, sorted by values in the field that corresponds to the sym attribute, and specifies that the id attribute will represent ctp when it is referenced by an SREL:

OBJECT ctp {
   ATTRIBUTES Contact_Type {
       sym                 STRING REQUIRED ;
       delete_flag del     INTEGER {
          ON_NEW DEFAULT 0 ;
       } ;
       description desc    STRING ; 
   } ;
   FACTORY {
       STANDARD_LISTS {SORT_BY "sym"} ;
       REL_ATTR  id ;
   };
};