>I have to modify a form. Right now that form returns an ID. Now I have to modify it so it returns an ID and the description that goes with that ID.
>
>Usually when I did something similar I modified each places where that form was called and modified the code so it would work with the additional parameters.
>
>But now I'm wondering about the beautifulness <s> of the following approach. I'm wondering because in that case there are many places the modified form is called.
>
>So instead of modyfying each place the form is called I'm thinking of adapting the code in unload and change what is unloaded according to the parameters passed to the form.
>
>Example:
>
>
>do form Whatever with InitialID
> The code in the unload would'nt return the description
>
>do form Whatever with InitialID, "ReturnDescription"
> The code in the unload would return the description
>
>
>So is this acceptable or is there something that I don't think of that makes this a stupid approach?
You could do this, but you could do also:
Add a property array in that form:
do form Whatever with InitialID NAME oForm TO myObject NOSHOW
DIMENSION oForm.AddedProperty[2]
oForm.AddedProperty[1] = [SomeTable.Id]
oForm.AddedProperty[2] = [SomeTable.Description]
oForm.Show(1)
? myObject.SomeTable_Id
? myObject.SomeTable_Description
LOCAL loReturns, lnFor
loReturns = CREATEOBJECT([EMPTY])
FOR lnFor = 1 TO ALEN(this.AddedProperty,1)
ADDPROPERTY(loReturns,CHRTRAN(this.AddedProperty[lnFor],[.],[_]),EVALUATE(this.AddedProperty[lnFor]))
NEXT
RETURN loReturns
**** UPDATE: I just saw that you ask for VFP7, so change ALEN(...,1) TO ALEN()
**** and add only one dimensional array :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.