I want to get sublist of values from my OptionString.I tried by assigning option index (ie,0,1,2,3) but din’t get the Range of value as i expect. Please help me…
e.g I have 2 Drop Down List.I want to show only selected values in my 2nd Dropdown list depending on the 1st Drop Down List Value.
It’s not possible to change the OptionString on run time. Instead you can predefine different options which should used depending on the value of your first option field. In my example below I have a field (Option1) with the values A to D. And then I have created 4 fields (Option2A to Option2D) and depending on the value of Option I either hide or display the correct Option2 field.
You create two versions of your second dropdown list. On including 100,101,102,103…110 and one including 200,201,202,203…210. And just follow the same steps as above.
But I have a different question. Why do you want to use the option fields for this? To me the values look more like something you shouldn’t be hard coding into your solution. Instead you could use a table for both option 1 and 2, where table two would have the option 1 key as the first key.
The general advise regarding option fields is that they are only to be used for very simple and very static values. Option fields in general should never carry real information. But then again I don’t really know what the values are representing.
You are looking for dropdown box behavior that is seen in other development tools, such as the dropdown box in MS Access, or in the Winform designer in Visual Studio. This is simply not possible in NAV. Option type fields are defined at design time, you can’t change values at runtime, and they don’t have indexed values either.
Internally, an option type variable is stored as an integer. I always have to check to see if it starts at 0 or 1.
The way you would do what you are trying to do is either by following Erik’s advice (you should really try to make that work instead of dismissing it right off the bat), or create a couple of tables that you can filter. It is simply not possible to have a dynamic dropdown box in C/SIDE.
I remember having the same question when I started out [:D], I used to work with VBA quite a bit. Seems like somewhere a bunch of VB programmers were put to work on a NAV project.
Hehe that’s great! VB wasn’t really around when I started with Navision. Back when I learned programming everything was character based. I learned Pascal (Poly Pascal and Turbo Pascal - which was really big back in the 80’ies - same language the guys who made Navision knew) and Cobol - which actually also was a great language for programming business applications. Very structured!
So all this fancy stuff you can do with forms and controls in the Windows world I never learned.