Using pre- and post-event handlers
If you plan to customize Tivoli Asset Management, Tivoli Systems recommends that you do the following:
Flexible fields are extra, unused fields defined in certain tables of the database. With flexible fields, you can:
You can add new text boxes to view or edit flexible field data in certain dialog boxes. To use flexible fields, add text boxes to the appropriate dialog boxes with the Interface Designer. The Control_ID value for the text box must match the name of the flexible field in the table, such as flx_einv_vchr1. This allows values entered in the text box to be automatically saved to the database. For detailed instructions about how to create text boxes within a dialog box, see your TSD Developerâ™s Toolkit online help.
Note: If you want to be able to use a flexible field to inquire for or search for records, you can improve system performance by creating an index on that flexible field column.
Table Name | Flexible Field Name | Data Type |
PEOPLE | FLX_PEO_VCHR1 | VARCHAR2(254) |
FLX_PEO_VCHR2 | VARCHAR2(254) | |
FLX_PEO_VCHR3 | VARCHAR2(254) | |
FLX_PEO_VCHR4 | VARCHAR2(254) | |
FLX_PEO_VCHR5 | VARCHAR2(254) | |
FLX_PEO_VCHR6 | VARCHAR2(254) | |
FLX_PEO_INT1 | NUMBER(38) | |
FLX_PEO_INT2 | NUMBER(38) | |
FLX_PEO_INT3 | NUMBER(38) | |
FLX_PEO_INT4 | NUMBER(38) | |
FLX1_PEO_DATE | DATE | |
FLX2_PEO_DATE | DATE | |
FLX1_PEO_TIME | VARCHAR2(10) | |
FLX2_PEO_TIME | VARCHAR2(10) | |
VALUATION | FLX_VAL_DATE1 | DATE |
FLX_VAL_DATE2 | DATE | |
FLX_VAL_DATE3 | DATE | |
FLX_VAL_VCHR1 | VARCHAR2(254) | |
FLX_VAL_VCHR2 | VARCHAR2(254) | |
FLX_VAL_VCHR3 | VARCHAR2(254) | |
FLX_VAL_INT1 | NUMBER(38) | |
FLX_VAL_INT2 | NUMBER(38) | |
FLX_VAL_INT3 | NUMBER(38) | |
IS_INVENTORY | FLX_ORG_VCHR1 | VARCHAR2(254) |
FLX_ORG_VCHR2 | VARCHAR2(254) | |
INVENTORY_HISTORY | FLX_IHIST_VCHR1 | VARCHAR2(254) |
FLX_IHIST_VCHR2 | VARCHAR2(254) | |
FLX_IHIST_VCHR3 | VARCHAR2(254) | |
FLX_IHIST_FLOAT1 | FLOAT(126) | |
FLX_IHIST_FLOAT2 | FLOAT(126) | |
FLX_IHIST_FLOAT3 | FLOAT(126) | |
ORGANIZATION | FLX_ORG_VCHR1 | VARCHAR2(254) |
FLX_ORG_VCHR2 | VARCHAR2(254) |
The DelegateEvent statement and pre- and post-event handlers streamlines the customization process.
DelegateEvent is called before and after every event handler in the application (including those in the data utilities). Therefore, you can make functional customizations in pre- or post-event handlers within the i_events.kb file. By making changes in the event handlers or i_events.kb file, you can keep your changes in a central location and reduce the number of modifications to the original programs.
Each instance of DelegateEvent returns an integer value for the pre- or post-event. Depending on the return code value, the original code associated with the event is either skipped or executed.
The DelegateEvent statement for pre-event processing is included as the first line of every event handler. The DelegateEvent statement for post-event processing is included as the last line of every event handler.
In order to call DelegateEvent, the i_events.kb file must be included in the USES chain of the calling program file. For example, in order for the i_expinv.kb file to call a pre- or post-event, it must have the i_events.kb file in its USES chain. The i_asset.kb file is already included in the USES chain of the shipped source files.
For Tivoli Asset Management, pre- and post-events are stored in i_events.kb. All pre-events use the following naming convention:
pre_i_eventhandler
All post-events use the following naming convention:
post_i_eventhandler
For example, the pre-event for the AssetCopy event handler is named pre_i_AssetCopyEvent, and the post-event is named post_i_AssetCopyEvent.
The parameter that is passed to an event handler will also be accepted by the pre- and post-event handlers for the event. When you pass a parameter to an event handler, the event handler works with the parameter as needed. In i_events.kb, the event handlers are created as follows:
Event pre_i_AssetCopyEvent (REF InvCopies: LIST OF IS_InventoryRec);Event post_i_AssetCopyEvent (REF InvCopies: LIST OF IS_InventoryRec);
The DelegateEvent statement passes the same variable that was passed to the original event handler. For example:
Event AssetCopyEvent (REF InvCopies: LIST OF IS_InventoryRec);
The call to DelegateEvent should also pass the same variable:
$Result:= DelegateEvent (pre_i_AssetCopyEvent,InvCopies) ;
Pre- and post-events should yield return codes as follows: