Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF in a Control Source
Message
From
28/08/2001 11:57:26
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00549697
Message ID:
00549878
Views:
14
>>Can I do an IIF statement in a textbox.controlsource? Further, can that IIF statement call a UDF which passes a value back to the control source for display on the screen?
>>
>>Thanks, Randy
>
>From the property sheet, no (Data Source for this object must be a variable reference). From the Init method I was able to do:
>
>this.ControlSource = IIF(condition,'FirstVar','SecondVar')
>
>and it was accepted and updated the proper variable.

Note that we're talking about two things here: one is an iif() used to determine what would be the controlsource (that's what you suggest), and the other is something like

.controlsource='(iif(condition,alias1.field1,alias2.field2))'

which would be recalculated on each refresh. Note the parentheses around the whole expression, which tell the PEM parser (or whatever the engine may be called) to re-evaluate the expression, instead of evaluating it only once, or binding it permanently.

Though, I think a field like the one above may be read-only or at least unbound. I know this is a regular way to include a calculated field into a grid - use something like this in column's controlsource, but I'm not really too sure whether it is bound or not.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform