How to change the contents of Option string while running the program

I have one doubt. In my form I have two option field.In the beginning Options in first field is ‘a,b,c’ and second field is ‘s,t,u,v,x,y,z’.when we select option ‘a’ in the first field, i want to show only only two options in second field ie, ‘x & y’.How can i change the contents of second field depending upon the value in the first field while running the programme. How can i filter the options of the second field based on the first field?

you cannot change options. I suggest to use a table.

Are you working with RedRose?

I was just thinking the same. And based on their IP numbers, then they are! [^o)]

Yes, you can change the options “on the fly”. But you need to do it with a small trick:

You need two controls with the same SourceExpression which are on the same position.
The controls make use of the OptionCaption (OptionCaptionsML respectively).
You just need to set the optioncaption to ‘,x,y’ for the second new control (omitting the options you do not want to see).

Then you need to give different names to both controls.
In the “OnValidate” trigger of the first Option (a,b,c) You switch the visibility of the two new controls:

CurrForm.Option1.VISIBLE := OptionValue1 = OptionValue1::a;
CurrForm.Option2.VISIBLE := OptionValue1 <> OptionValue1::a;

Smart solution.

Can you make it Language independent?

Sure, you use the “OptionCaptionML” and therefore it is “language dependant” or “Multi-Language enabled”

That’s exactly the same solution as having two different option variables, and showing only one of them based on a condition. It is trickery, you’re not modifying the options, you’re using different options altogether. It’s pretty smart trickery, but still [:)]

By the way, I don’t think this is going to work in the Role Tailored Client.

Yes this also works in the role tailored client.

There you need to make sure that both controls (fields) are placed behind each other.

of course the VISIBILITY stuff is a little bit more complex. You need to use two different bool variables which are included in the dataset and assign those to the visible property of the control.

Change the value of those variables in the OnValidate trigger mentioned earlier.

Won’t you have the option to show both of the fields through adjusting the page properties? You can’t place a control in a predefined location on a page, or am I missing something?