The underlying class hierarchy can be calculated from any instance created by following the steps below and using the resources attached to this message:
Library Prerequesites:- Class Hierarchy Calculation Module is available in the library and loaded
- Instance Attributes have been defined to hold the results of the calculation
- Trigger is defined according to the needs
For the following example snipplet the following is assumed:- The trigger for the calculation is the user, clicking on a button in the notebook of the instance
- The attributes "Class hierarchy (ID)" and "Class hierarchy (Name)" are available in the instance to store the return values of the procedure
- The PROCEDURE of the Calculation module is loaded during application startup
Steps:1. Add 3 attributes to the root object of the library "__D-contruct__" (this makes sure that it is available for all classes)
a. Attribute name: "Class hierarchy (ID)" TYPE: STRING; this attribute is set after calculation with class ID tree of parent classes
b. Attribute name: "Class hierarchy (Name)" TYPE: STRING; this attribute is set after calculation with class name tree of parent classes
c. Attribute name: "Calculate class hierarchy" TYPE: PROGRAMCALL; this attribute shows the button in the notebook to trigger the calculation of the class hierarchy
2. Define the AdoScript to be run on PROGRAMMCALL: see attached file triggerClassHierarchyCalculation.asc: add the content of the file to the facets of the attribute
3. Add attributes to the AttrRep of classes
1CHAPTER "ClassHierarchy"
2ATTR "Class hierarchy (ID)"
3ATTR "Class hierarchy (Name)"
4ATTR "Calculate class hierarchy" no-param push-button
4. Add file using library file management function "class_hierarchy.bin"
5. Load file "class_hierarchy.bin" ON_EVENT "AppInitialized"
1ON_EVENT "AppInitialized" {
2...
3EXECUTE file: ("db:\\class_hierarchy.bin")
4...
5}
6. Test for the class, using the notebook button for calculation. Remove the INFOBOX commands to remove the UI interaction.
.