QXtend Outbound Business Objects > Creating New Business Objects > Creating a Business Object for Custom Tables
  
Creating a Business Object for Custom Tables
Use the following steps to create a new business object that references data from custom QAD Enterprise Applications tables, a custom side database, or a non-QAD Enterprise Applications Progress database.
1 In the left-hand Business Objects frame, click New. The Business Object definition screen displays.
2 Enter values as described in step 3 under Modifying Business Objects.
3 Use the Tables button to add tables to the object. QAD QXtend reads all the tables from the connected database and displays them for selection. Click OK to save the table definitions.
4 Click Save to save the new object.
5 Create event types for each table to be referenced using the instructions in Adding Source Application Event Types. Ensure that the new event types are active.
For each table associated with an active event type, add a replication write and replication delete trigger to the schema. Create a .df file with an entry for each table you are activating using the instructions in step 7 under Creating a Standard Business Object as a model.
For custom QAD Enterprise Applications tables, you can use MFG/UTIL to load the .df file. For other applications, use the tools supplied with your application.
6 Trigger files are provided with QXO for all standard QAD Enterprise Applications tables. For non-standard tables, you must create replication write and replication delete trigger files for each affected table. Use the following code samples as a model.
For QAD SE and above, this is the trigger procedure for replication write for cm_mstr:
/* RECORD OUTBOUND EVENT. */
{qxotrig.i
&TABLE-NAME = 'cm_mstr'
&ROW-ID = string(rowid(cm_mstr))
&OID = string(cm_mstr.oid_cm_mstr)
&TRIGGER-TYPE = 'WRITE'}
For QAD SE and above, this is the trigger procedure for replication delete for cm_mstr:
/* RECORD OUTBOUND EVENT. */
{qxotrig.i
&TABLE-NAME = 'cm_mstr'
&ROW-ID = string(rowid(cm_mstr))
&OID = string(cm_mstr.oid_cm_mstr)
&TRIGGER-TYPE = 'DELETE'}
The &DOMAIN-CODE value is intended for use with QAD Enterprise Applications versions eB2.1 and above, which support separate logical partitions within a database. If your application database can be split into categories similar to QAD Enterprise Applications domains, you may want to use this entry; otherwise, leave it blank.
If you do decide to use the domain value, you must define the domain to QXO. See Adding Source Application Domains.
7 After adding schema triggers and creating the corresponding trigger code, you must compile the code using your application compiler. For QAD Enterprise Applications custom tables, you can use MFG/UTIL.
8 Add the trigger file directory to the application PROPATH so that the code can be executed.