Hi Cetin,
There will be 1-10 objects (1 object created from each record). The name of the object will be determined by the values in 2 of the table's fields:
1st Record Example:
mytable.field1 = 'DATA'
mytable.field2 = 'QCC'
The created object's name will be oDATA_QCC for the first record.
The servername property of oDATA_QCC will be 'myservername' e.g. :
IF mytable.field3 = 'myservername':
oDATA_QCC.servername = TRIM(mytable.field3)
So the object can be referenced later based on the two fields in the table (in order to know which object to use)>>Maybe I am just slow this Monday morning. If I want to create an object reference on the fly and set the values of its properties (Object will be public not local):
>>
>>For example:
>>
>>* Table with values to use for object's properties
>>* Mytable.cname && cName will become part of object's name
>>* Mytable.ctype && cType will become part of object's name
>>* Mytable.cserver && cServer will be the object's pServerName value
>>* Scan through the table 'mytable' and create an object from each record
>>
>>
>>lcConn = "'o'+mytable.cname+'_'+mytable.ctype
>>PUBLIC &lcConn
>>&lcConn = CREATEOBJECT('ConnClass.ConnObj')
>>lcConnServer = lcConn + '.pServerName'
>>&lcConnServer = TRIM(mytable.cserver)
>>
>>or
>>
>>&lcConnServer..pServerName = TRIM(mytable.cserver)
>>
>>or
>>
>>loControl = EVAL(lcConn)
>>loControl.pServerName = TRIM(mytable.cserver)
>>
>>or
>>
>>STORE TRIM(mytable.cserver) TO (lcConn+'.pcServer')
>>
>>
>>
>>Or is there a better way? Which will be fastest if I have to create 10 similar objects with 10 properties each sequentially? Which will be easiest to maintain (by other developers)?
>
>Tracy,
>I'm not sure I follow it right, anyway:
>
>
>select cServer as pServername from myTable into cursor myServers nofilter
>oApp.AddProperty( "loConn["+ltrim(str(reccount()))+"]" )
>scan
> oApp.loConn[ recno() ] = CREATEOBJECT('ConnClass.ConnObj')
> oApp.loConn[ recno() ].pservername = trim(pServername)
>endscan
>
Cetin
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"