[stackoverflow] [progress Openedge Abl] Create Objects Dynamically According To Class Files...

Status
Not open for further replies.
A

Ashton Woods

Guest
We have a folder with many classes that inherit from the same base class. Their names are formatted like this:

  • firsttypesubclass_1.cls
  • firsttypesubclass_2.cls
  • firsttypesubclass_3.cls
  • secondtypesubclass_1.cls
  • secondtypesubclass_2.cls

The program should scan this class folder and create a temp-table with the class-name prefix and count (f.ex "firsttypesubclass" and count=3):

DEFINE PUBLIC TEMP-TABLE TT_AllSubClasses NO-UNDO
FIELD Name AS INT /* f.ex "firsttypesubclass" */
FIELD Name AS INT /* f.ex "firsttypesubclass" */
.


Then we need to create new instances dynamically according to the found classes in a loop like this:

DEF VAR newInstance AS CLASS myBaseClass NO-UNDO.
testi = DYNAMIC-NEW TT_AllSubClasses.Name + "_" + STRING(1)(123123) NO-ERROR.


Is there any convinient way to list the class names in the folder? Or is it possibly to get all classes that inherit from the baseclass? I'm thinking about using the file system for checking up the files.

Continue reading...
 
Status
Not open for further replies.
Top