Saving Values of Global variables

HI All,

I wanto save values of global variables on a form.

Actually My req’ is , I have created a Vehcle card -form , Where i have control called "Engine " which is of optional type , if i select ‘damaged’ option for this control , i have to get a mesage called 'engine shd be replaced ’ . For this am taking a Textbox control , for whch i have assigned a global variable called ’ Txt1’ as a Source Exp.

Thte value of TXt1 is "Engine shd be replaced ", I wll get this value in my textbox control , when i selct ‘damged’ option for Engine control.

This value could be same for every vehicle , where engine=damaged.

Like this i have around 50 controls on my form. So for every vehcle , i set some values for option controls , According to tht i got some textmessages…

When i open form for perticular vehcle these values are resetting to their default values . How can i save these values…

Regards

Venu.

The obvious answer would be to create fields in the table and store the values in the database, and control the values in the OnValidate of those option fields. You could create a function on the form that sets the messages, and call the function in OnAfterGetRecord or OnAfterGetCurrentRecord. You could create a bunch of functions in the table that return the messages, and set the SourceExpr of those message controls to those functions. You could do a bunch of things.

Well, I think your problem can be solved most easily, if you create for every option field (Engine, e.g.) in your form an additional textbox with the following properties:

SourceExpression=Engine
Editable=No
DropDown=No
OptionCaption= ,some text for option1,engine shd be replaced,some text for option3

This solution has the advantage, that you don’t need any additional code in the OnValidate triggers (and the OnOpenForm trigger to initialize your textboxes) and you can easily achieve multilanguage behavior bei using the CaptionML property.
One disadvantage may be, that the text in the OptionCaption property can not be longer than 1024 characters (for all options together).

I hadn’t thought of that, that’s actually a pretty smart way to do it [Y]