Friday, 24 May 2013

38. PROVIDING DROPDOWN LIST



When we know particular field will take some predefine values, then we will make it either a drop down or will provide a F4 help. 

If number of predefined values is less, then we will choose drop down. If they are too many, then F4 help is a better way. 

Let us make Process type field on search view as a drop down so that user will choose predefine values from the list. 




There are two methods in which we need to code to make a particular field as a drop down.
1.       GETTER P method: in this method we tell to the frame work that this particular field will act as a drop down. 

2.       GETTER V method:  Here we will provide the values to be shown in the drop down list.
As we want to provide the drop down list to the process type field on the search page, we need manipulate of above mentioned methods of that attribute. 

Go to the search view, expand the context node and  choose the search context node and again expand the attributes. 




 Select the required attribute. Right click on it and choose the options GENERATE V GETTER and P-GETTER methods one by one to generate the corresponding methods. 





Once you generate , you can see the methods generated under the attribute.








Double click on the GET_P_PROCESS_TYPE method and add the following code in that method.






Go to the V – getter method and copy paste the following code. 





That’s it. We have created the drop down for particular field.  We can use any custom table and query it if we want to show the custom table data as a drop down.  Values should go always as key pairs. On the web ui, frame work only shows the values. Go for the drop downs when for small values of list.
Go and test the application to see the drop down list. 



1 comment: