In this lesson we are going to learn how to create Message Choice item in the OAF page.
The bean for message Choice is item is “OAMessageChoiceBean”.
Step 1: First create Item in the page and select Item Style as MessageChoice in Property Inspector.
Step 2: After creating the page create the VO (View Object) in respective BC4J and attach VO to AM (Application Module).
Creating VO process:
Right Click on Resources folder of project and then select New View Object… as shown in the below figure:
After that a welcome page to create a View Object wizard window will open as shown below:
Click on Next button so that first step to create a VO will come and in that :
Package : Select the proper package name which we created for a project.
Name : give the name to the VO note that all the View objects ends with VO.
Click on Next button:
Click on Next Button, no need to select any package or attributes here:
Click on Next button without any changes:
Click on Next button without any changes so that we can see the Query area to enter SQL query to retrieve the data, write the SQL Query in the Query Statement
After writing the Query statement check whether the written Query is valid or not by clicking on Test so that if the query is valid then it shows a message that Query is valid. After that click on Next button.
Click on next button to step 8:
Click on next button and click on Finish button:
After creating VO (view object) we need to attach VO to AM (application Module). Let us see how to attach VO to AM:
Attaching VO to AM:
Edit the AM which we created in the project, right click on AM and then select Edit <AM Name> as shown in the below figure:
Select Data Model, extract the package in which VO is created select the VO after selecting the proper VO click on the Greaterthan arrow symbol which is shown in below figure:
After that we can see the VO is attached to the AM as shown in the below figure:
Click on Apply button and then on OK button so that the attachment process of VO to AM is over.
Step 3: Select the item properties in that do the following:
Picklist View Instance : Give the VO name
View Instance : Attribute Name, the displayed list values. (Column Name, in VO columns are converted into attributes).
View Attribute : Attribute Name
Now run the page so that we can see the output with drop down list to pick some values. The below image shows the output of Message Choice along with other items in OAF page.
Note that a drop down list can handle a maximum of 200 values.