Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set a variable to a property?
Message
 
 
To
01/04/2021 00:35:44
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01679404
Message ID:
01679426
Views:
43
>>>>How do you set a property to a public variable?
>>>>
>>>>For example, I have a BIZ object that has a property PRE_FILTER. I set the value of this property to =cTest
>>>>The cTest is a public variable (for testing) and I set the value of "IN_SERVICE = 'Y'" to this variable.
>>>>But it has no effect. That is, when BIZ object is instantiated, it ignores the =cTest
>>>>What am I missing?
>>>>
>>>>UPDATE. If I set the value of the property PRE_FILTER to IN_SERVICE = 'Y', it works. So, the problem must be the way I set the variable to the property.
>>>
>>>What were you trying to do? Were you trying to assign IN_SERVICE property to the string "IN_SERVICE = 'Y'" or the value you get when this string is evaluated?
>>
>>The value in the property PRE_FILTER is added to a long SQL Select (of course, if it has a value). So, when I set the value of IN_SERVICE ='Y' to this property, it works. the SQL Select has it and the resulting query is affected.
>>
>>But when I set the value to a variable (and I have not yet evaluated the actual SQL Select, which I should do), the SQL Select works as if no value is set in the property PRE_FILTER.
>>
>>UPDATE. In the debugger the value in the property PRE_FILTER is .F. So, basically, when using =cTest, VFP evaluates. But this is not what I wanted.
>
>Does the variable you're using in the assignment exist, is assigned the value you're expecting (and is visible in the context) at the time the object is created?

Please see my reply/message to Antonio Lopes.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform