>>>>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.
>
>Dmitry, are you defining the class in a Visual Class Library (*.vcx) or in a Program File (*.prg)?
>
>This is the effect you want, right?
>
>
>PUBLIC cTest AS String
>
>m.cTest = "IN_SERVICE = 'Y'"
>
>LOCAL DLI AS DL
>
>m.DLI = CREATEOBJECT("DL")
>
>? m.DLI.PRE_FILTER
>
>DEFINE CLASS DL AS Custom
>
> PRE_FILTER = m.cTest
>
>ENDDEFINE
>
Antonio,
Thank you for your message.
The class is in the Visual Class Library (*.VCX). Let me provide more details:
I have a form class (equipment) in a library equip.vcx
There is a BIZ class dropped on this form (BIZ class is EQ_BIZ).
The BIZ class EQ_BIZ has a property PRE_FILTER.
I am trying to set the value of PRE_FILTER to some public variable cTest. The public variable cTest is declared in the LOAD of the EQUIPMENT form; therefore, it is in the scope when the EQ_BIZ is initialized.
I am trying to figure out how to assign the value of the variable cTest to the property EQ_BIZ.PRE_FILTER.
I tried:
(at design time): setting the value of EQ_BIZ.PRE_FILTER = cTest This does not work.
I also tried to use a macro, Example: EQ_BIZ.PRE_FILTER = &cTest. This does not work.
Do you see what I am trying to do?
"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