As you said Antonio, __ObjAddData() adds DATAs to the class and not just the particular object it is called against. For my purposes that isn't a problem though.
It looks like I will end up with a RECORD class and a RECORD_LIST class.
Initial version will subclass these. Subclass will basically have a controlling array (set up by a series of #xcommands).
Subsequent version will not need subclassing but read parameters from a file.
I will be supporting:
data name conversion (UI independant of data storage) (in and out)
type conversion (in and out)
default values (for Blank() functionality)
field lengths (which may not be available from other modes of persistence)
Only just started but #xcommand version is looking like this:
- Code: Select all Expand view RUN
XLATE PT_KEY TO sKey AS PKEY
XLATE PT_NMFAMLY TO sNmFamly AS STRING LENGTH 32
XLATE PT_NMGIVEN TO sNmGiven AS STRING LENGTH 32
XLATE PT_NMOTHER TO sNmOther AS STRING LENGTH 32
XLATE PT_NMPREV TO sNmPrev AS STRING LENGTH 32
XLATE PT_NMPREF TO sNmPref AS STRING LENGTH 16
XLATE PT_NMTITLE TO sNmTitle AS STRING LENGTH 8
XLATE PT_DOB TO dDOB AS DATE
XLATE PT_GENDER TO cGender AS CHAR
XLATE PT_ADLINE1 TO sAdLine1 AS STRING LENGTH 32
XLATE PT_ADLINE2 TO sAdLine2 AS STRING LENGTH 32
XLATE PT_ADSUBRB TO sAdSubrb AS STRING LENGTH 24
XLATE PT_ADSTATE TO sAdState AS STRING LENGTH 3 DEFAULT "NSW"
XLATE PT_ADPCODE TO sAdPCode AS STRING LENGTH 4
XLATE PT_ADCNTRY TO sAdCntry AS STRING LENGTH 24
XLATE PT_PHHOME TO sPhHome AS STRING LENGTH 16
XLATE PT_PHWORK TO sPhWork AS STRING LENGTH 16
XLATE PT_PHMOB TO sPhMob AS STRING LENGTH 16
XLATE PT_PHFAX TO sPhFax AS STRING LENGTH 16
XLATE PT_EMAIL TO sEmail AS STRING LENGTH 24
XLATE PT_MEDIC TO sMedic AS STRING LENGTH 10
XLATE PT_MEDPOS TO sMedPos AS CHAR
XLATE PT_VETAFF TO sVetAff AS STRING LENGTH 20
XLATE PT_ACTIVE TO cActive AS CHAR
XLATE PT_LUBY TO sLUBy AS SKEY
XLATE PT_LUWHEN TO sLUWhen AS DATETIME
XLATE PT_LUACTN TO cLUActn AS CHAR
"AS STRING" is optional as it is the default. This is processed into an array along the following lines:
- Code: Select all Expand view RUN
#xcommand XLATE <fname> TO <pname> AS STRING LENGTH <length> => AADD( ::aPROPERTIES, { <"pname">, <"fname">, , "S", <length>, 0 } )
Since it is all controlled by an array conversion to being data driven should be straight forward.
Code generators were never quite adequate, but data driven is IMHO the way to go. I have done that in a Web based system (with a series of major commercial systems now using that technology). The thing that made it work where generators fail was the ability to include user defined script almost anywhere and the fact that everything was dynamic. xBase with its code blocks might be one of the few other systems where this approach could be as successful.
Regards
Doug
(xProgrammer)