Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Assigning value to property of object indirectly
Message
From
20/11/2015 17:49:08
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
 
 
To
20/11/2015 17:27:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01627690
Message ID:
01627692
Views:
69
>Hi all,
>
>This is probably a "Friday afternoon brain fart" type of thing but coding a utility class that has a function where I pass in:
>
>tcObjectName
>
>tcProperty
>
>tuValue
>
>That is, I want to have a generic function that assigns a value to a property of an object. I first loop through a collection to get an object reference to the named object to yield toSavedObject
>
>I know this works:
>
>
>
>STORE tuValue TO toSavedObject.&tcProperty
>
>
>
>Is there any other way to get the value into the property without using the ampersand?
>
>I tried indirection but that did not work e.g.
>
>
>
>STORE tuValue TO ( toSavedObject + "." + tcProperty )
>
>
>
>I know I can keep trying but figure I would ask and maybe there would be an answer when I get in Monday morning :-)

Have you considered passing in a parameter object, rather than individual parameters? It doesn't do anything to address your immediate question, but you might find it simplifies some sorts of generic methods or processes.

http://fox.wikis.com/wc.dll?Wiki~ParameterObjects~SoftwareEng (and the See Also links near the top)
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform