Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unload depends on parameters
Message
 
To
23/03/2006 13:52:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01107112
Message ID:
01107122
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
>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

**** In Unload of the WhatEverForm :-)
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform