Search This Blog

Saturday, March 19, 2016

16. OAF Search Pages

Search Pages


In this chapter we will see how to create search pages in OAF and how many different types of search pages are there in OAF.
 
We have three types of search pages in OAF
  • Automatic Search
  • Result Base Search
  • Manual Search

Automatic Search is again divided into two types:
  1. Inline LOV
  2. External LOV
Automatic Search and Result Base Search will take care by the Query Region where as for Manual Search we have to write the condition manually.

We will see in the coming chapters how to create the search pages in Oracle Apps Framework.


Automatic Search Inline LOV


In this lesson we will see how to create Inline LOV search page.
Inline LOV is used to search with in the page.
 
The following are the steps to create Inline LOV
Step1: Create the new WorkSpace and project, create new page add AM to the page.
Step2: Create new VO in respective BC4J. While creating VO change the package name of BC4J to “.lov.server” at end, generally List of Values VO ends with LOVVO and the example BC4J path is:
 
Package (BC4J) : xxinlinelov.oracle.apps.po.inlineprj.lov.server
VO name : InlineLOVVO
Query in the VO is:
[sql]SELECT first_name FROM PER_ALL_PEOPLE_F[/sql]
 
The Application Navigator of the project now looks like:
 
Application Navigator of Inline LOV OAF
 
Step3: Under the main page create new item and select item style in property Inspector as “MessageLOVInput”.
We can find List of Values region under Message LOV Input item.
Right click on the List of Values region select New -> Table Using Wizard…
Here we can create Table Style region only we cannot change the region style to another one.
 
See the below image it shows that how the page structure will look now:
Inline LOV search page structure in OAF
Select the FirstName item under the table region and then in the property Inspector of that item check that in the Functional, Search Allowed is set to True.
 
Step4: Select LOV Mappings in the structure of Message LOV input after that do the following changes in the property inspector of lovMap1.
 

Functional:

LOV Region Item : FirstName  (the item to display in the LOV region)
Return Item : item1 (the item to return)
Criteria Item : item1 (criteria item works like in where condition value)
 
Run the page and see the output. The first page of the output looks like the following:
LOV output in OAF
 
click on the search symbol searchso that it leads us to another page as shown in the below figure:
 
Inline LOV search page in OAF output
Check the Radio Button of which employee you want to choose and then click on Select button or use Quick Select option to select the name which is required.
 
After choosing the name it will display in the Message Text Input item as follows:
Selected value from Inlinelov search page in OAf


Automatic Search External LOV


In this lesson we are going to see how to Create Automatic Search using External LOV and the uses of external LOV in oaf. The difference between inline LOV and External LOV is inline lov is used only inside the page where as external LOV we can use for other pages inside the project.
So therefore the use or advantage of External LOV is if we want a list of values to be used for other pages in the project then we can create External LOV region and we can use the created region in any pages of the project.
 
Steps to create External LOV in oaf are follows:
 
Step1: Create Workspace, project , AM and create one page assign AM to the page give page title and window title.
For example :
workspace name : externlallov
Project Name : ExternallovPRJ
package name : externallov.oracle.apps.po.externallovprj.webui
AM name : ExternallovAM
AM Package name: externallov.oracle.apps.po.externallovprj.server
 
Step2: Right Click on the project select new as shown in the below picture.

External region creation in OAF
After selecting new option we will see a gallery window in that extract web tier in categories select OA Components  and then select Region  in items list.

External region in OAF

After selecting region click on ok button so that a window will get open in that
Name : Give any user defined name
Package: Select the proper package of the project.
Style : select style as List of values.

Details of External region in OAF

Now one .xml region will be created under webui.
 
Step3: Create on VO under the lov package for example select the package name as follows:
externallov.oracle.apps.po.externallovprj.lov.server
VO Name is : externalLOVVO
Query in the lov is :-
[sql]SELECT FULL_NAME FROM PER_ALL_PEOPLE_F[/sql]
 
Step4: Attach VO to the AM.
Step5: Under the region create one item and item style as Message LOV input. In previous lesson we already seen how the Message LOV input item structure look like.
 
The below image shows how the Application Navigator and page structure of the project looks like:
Application Navigator and page structure

Step6:  Under the Message LOV input region create on table region using wizard. In the table region select the proper package name and then as we attached our VO to the AM it will display our LOVVO so select that VO and therefore a table region will be created with one item under it.
Step7: Select the Message LOV input item and in the Property Inspector of Message LOV input select External LOV as shown in the below figure:
 
Selecting external lov in OAF

Click on the icon icon so that the following window will get opens

External LOV selection window in OAF

Click on the Browse button and then select the proper package name for example see the below picture:
 
Browsing package in extenal lov

Click on the search button and then select the fully qualified name in the search results for example see the below picture:
 
Fully qualified name in external lov OAF

Click on OK button so that JDeveloper asks for confirmation in that click on OK button.
 
Confirmation message for extenal lov oaf
 
Step8: Run the page and see the output. The following three images shows the output and its work process

External lov output OAF

Click on the search image searchso that it displays list of values as shown below.

External list of values in OAF

Select any value whichever you want to select. Use Quick select or radio button process:

Selected result from external lov in OAF

Result Base Search


In this lesson we are going to see how to create Result Base Search.
Result base search will give the search results so the results whatever we are seeing in the page are just for display purpose we cannot select the resultant values like the way we select in Inline LOV or External LOV.
 
Steps to create result base search page in oaf:
 
Step1: Create Workspace, project , AM and create one page assign AM to the page give page title and window title.
 
For example :-
workspace name : ResultBaseSearch
project name : ResultbasesearchPRJ
package name : xxresultbasesearch.oracle.apps.po.resultbasesearchprj.webui
AM name : ResultbasesearchAM
AM Package name: xxresultbasesearch.oracle.apps.po.resultbasesearchprj.server
 
 
Step2: Create new VO in respective BC4J, generally List of Values ends with VO and the example BC4J path is:
Package (BC4J) : xxresultbasesearch.oracle.apps.po.inlineprj.server
VO name : ResultBaseSearchVO
Query in the VO is:
 
[sql]SELECT PERSON_ID, 
            FULL_NAME, 
            DATE_OF_BIRTH,
            KNOWN_AS, 
            NATIONALITY 
     FROM PER_ALL_PEOPLE_F[/sql]
 
 
Step3: Attach VO to the AM
Step4:- After creating VO and attaching it to AM, in this step create new region under main region and select the region style in property inspector as Query. It means we need to create a Query region under the main region.
 
Creating New Query Region in OAF
After creating Query Region in main region select the Query Region property Inspector and in Property Inspector select Construction Mode as Result Base search as shown in the below figure:
Property Inspector of Query Region
Now in the page structure select the Query region, right click on the Query region select New -> Region Using Wizard…
Region using wizard in Query Region
Select Proper Application Module in the first step of creating region as show in the below figure:
Selecting AM in Region OAF
In step2 select the region style as Table as show in the below image:
Region style in OAF
In step3 select the attributes of VO which you want to display in the output.
Attributes in OAF
Finish the Region using wizard process.
 
Step5:-  Run the page and see the output, if we observe in the output the Query region creates automatically Go and Clear buttons.
Output of result base search
Click on GO button to see the resultant output as shown in the below picture:

//Afzal: You can make search by fields also, just in the ResultBaseSearchVO1 table region, give any attribute(PersonId) property:Search Allowed True.Result base search output

Manual Search



In this lesson we are going to see how to create manual search page in OAF manually. Manual Search page we need to enter the data value to search for example employee names starting with ‘A’ then we used to type A% in oracle apps forms similarly in OAF the manual search page will work like.
 
Step 1: Create Workspace, project , AM and create one page assign AM to the page give page title and window title.
 
For example :
workspace name : ManualSearch
Project Name : ManualSearchPRJ
package name : xxmanualsearch.oracle.apps.po.manualsearchprj.webui
AM name : ManualSearchAM
AM Package name: xxmanualsearch.oracle.apps.po.manualsearchprj.server
 
 
Step 2:-  Create VO and attach VO to AM
VO Name is : ManualsearchVO
Query in the VO is :-
 
[sql]SELECT * FROM dept
WHERE deptno LIKE NVL(:1, deptno)
AND dname LIKE NVL (:2, dname)
AND loc LIKE NVL(:3, loc)[/sql]
 
 
Step 3:-  The below picture shows the requirement so there fore we need to create a page to achieve the requirement.
Manual search page reqiured output page
Now if we observe the above image we need to create three Message Text Input items for search and two button items.
After entering data in Message Text Input items and once we click on Go button then according to the search item provided the resultant values must be displayed in the below table region.
 
 
Steps to construct the page like above picture:
step 1: Create one message component layout region
step 2: Under message component layout region create three message text input items.
step 3: Create one Row Layout Region under main region, under Row Layout Region create two Submit buttons and if we want a space between two buttons then create one Spacer item between two submit button items.
step 4: Create one region using wizard and select region style as Table, select proper package name in which we created VO (ManualsearchVO).
 
After creating all the page structure may look like :
 
Manual search page structure in OAF
 
 
Step 4:- Open the java file of AM and create one method in AM and write the logic.
[sql]public void xxSearchParams (OAPageContext pc,OAWebBean wb)
{
  String dno = null;
  String dname = null;
  String loc = null;
  //ManualsearchVOImpl vo= getManualsearchVO1();
  OAViewObject vo= getManualsearchVO1();
  if(pc.getParameter(“item1”)!=null)
  {
    dno = pc.getParameter(“item1”).toString();
    vo.setWhereClauseParam(0,dno);
  }
  else
  {
   vo.setWhereClauseParam(0,null);
  }
  if(pc.getParameter(“item2”)!=null)
  {
   dname =pc.getParameter(“item2”).toString();
   vo.setWhereClauseParam(1,dname);
  }
  else
  {
   vo.setWhereClauseParam(1,null);
  }
  if(pc.getParameter(“item3”)!=null)
  {
   loc = pc.getParameter(“item3”).toString();
   vo.setWhereClauseParam(2,loc);
  }
  else
  {
   vo.setWhereClauseParam(2,null);
  }
  vo.executeQuery();
}[/sql]
 
 
Step 5:-  Create the controller and write the logic for buttons in Process Form Request of controller and here is the logic.
[sql]public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
  super.processFormRequest(pageContext, webBean);
  ManualsearchAMImpl am=(ManualsearchAMImpl)pageContext.getApplicationModule(webBean);
  if(pageContext.getParameter(“item4”)!=null)
  {
   am.xxSearchParams(pageContext,webBean);
  }
  if(pageContext.getParameter(“item6”)!=null)
  {
   OAMessageTextInputBean msb = (OAMessageTextInputBean)webBean.findChildRecursive(“item1”);
   msb.setValue(pageContext,null);
   OAMessageTextInputBean msb2 = (OAMessageTextInputBean)webBean.findChildRecursive(“item2”);
   msb2.setValue(pageContext,null);
   OAMessageTextInputBean msb3 = (OAMessageTextInputBean)webBean.findChildRecursive(“item3”);
   msb3.setValue(pageContext,null);
  }
}[/sql]
 
 
Step 6:- After writing logic in AM and Controller rebuild the code and run the page to see the output.
 
The resultant page may look like the following figure:
Output of Manual Search
Give some text in any Text input field and click on go button.
Manual search page output result look in OAF
 Reference: newtonapples.com

No comments:

Post a Comment