Message
From
04/01/2017 11:40:16
 
 
To
04/01/2017 11:00:16
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01646287
Message ID:
01646289
Views:
63
>Few days ago I had this:
>
FOR i = 1 TO oChild.DataParameters.COUNT
>	cPar = oChild.DataParameters.GETKEY(i)
>	xVal = oChild.DataParameters.ITEM(i)
>*	addproperty(oChild, cpar, xval)
>	oChild.ADDPROPERTY(cPar, xVal)
>ENDFOR
>
>This code works as it is now. However, with the commented line used instead of oChild.AddProperty(), it did nothing. The property wasn't added.
>
>Is it that addproperty() function has some cases when it doesn't work? Is it because oChild has its own addProperty() method? I've always thought that addproperty() function can be used on anything that is an object.

I remember some gotchas with array properties. The code looks ok, but I'd code it to make certain all assumptions are met
local....
loPara = oChild.DataParameters  && if item or getkey are arrays, perhaps do acopy ?
lnEnd = loPara.COUNT && we are betting against doc, so....
FOR i = 1 TO m.lnEnd
	cPar = loPara.GETKEY(i)
	xVal = loPara.ITEM(i)
        store .f. to llOk, llOkMeth &&& case of error and garbled error handling
	llOk = addproperty(oChild, cpar, xval)
        if ! m.llOk
           *** log perhaps as 1. step
	   llOkMeth = oChild.ADDPROPERTY(cPar, xVal)
           if ! m.llOkMeth
               *** on purpose put result values in locals, had 1 case involving with... whre return stack was corrupted 
          endif
        endif
ENDFOR
Previous
Reply
Map
View