Wednesday, June 22, 2016

SPEL In OAF

SPEL stands for “Simplest Possible Expression Language”.
SPEL is used to carry the values dynamically. SPEL will get the value dynamically at runtime. SPEL is the Boolean Value (True / False). The syntax of SPEL is:


Now let us see the previous chapter output which shows the Employee Information when we click on “Get Employee Information” button now the same output we are adding one image icon so that it appears to each and every row as shown in the below figure:


Now we will see the process how to add edit image for each row in a table. For that first we need a page structure as follows:


SPEL stands for “Simplest Possible Expression Language”.
SPEL is used to carry the values dynamically. SPEL will get the value dynamically at runtime. SPEL is the Boolean Value (True / False). The syntax of SPEL is:
1
Now let us see the previous chapter output which shows the Employee Information when we click on “Get Employee Information” button now the same output we are adding one image icon so that it appears to each and every row as shown in the below figure:
2

Now we will see the process how to add edit image for each row in a table. For that first we need a page structure as follows:
3
In the above page structure we created a region Using Wizard and the region style is “Table”.  Item1 is the submit button whenever we click on the Submit Button(Get Employee Information) it displays the employee information as shown in the below figure:


Now go to the table region, right click on the table region select New -> Item.
In the Property Inspector of item do the following changes:
  1. Select the Item style as
  2. In Image URI give the name of the image for example for edit image we have predefined images in “p9879989_R12_GENERIC\jdevhome\jdev\myhtml\OA_MEDIA” , give the following image in Image URI /OA_MEDIA/detailsicon_enabled.gif.
  3. In client action select Action Type as “fireAction“.
  4. In client action give Event name as “Edit
Now the page structure looks like:


Now run the page and click on the button “Get Employee Information” so that the output looks like the above picture what we have seen early.
Now whenever we click on the image item then it must show us the information in different form, for that we need to write the following code in processFormsRequest of controller:
if(“Edit”.equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL(“OA.jsp?page=/xxapples/oracle/apps/po/insertingrecords/webui/InsertDataPG”,
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
in IF condition “Edit” is the Client Action Event Name which we have given. The remaining code logic is same which we used in previous chapter takes us to create employee page but here we need to carry the data to that page rather than creating employee.
To achieve these requirement we need to create a spell, keep continue reading so that we will come to know how to create a SPELL in OAF.
SPEL creation in OAF, we know the syntax of SPEL now we need to create a SPEL for the image item in a table.
The SPEL value for the above is as follows:
${oa.EmployeeSearchVO1.Empno}
EmployeeSearchVO1 is the name of the VO which is used to get the details of employees.
Empno is the primary key value (attribute name)/ column name of the table in view.
Now we need to pass the above spel to image, for that select the image and then in Property Inspector,
Client Action -> Parameters


Once we click on the icon a Parameters window will get open in that, click on Add Parametersbutton and then give some name (example pempno) in the value pass the SPEL what we created ( ${oa.EmployeeSearchVO1.Empno} ). After giving name and passing SPEL value in the Value field click on OK button.

Now we need to call this parameter in the Create Employee page CO because whenever we click on the image item in the table list showing employee details it takes us to the Create Employee Page but it will not carry any values here our task is to carry values.
So therefore we need to write the code in processRequest of the controller class of Insert Employee details page. The code is as follows:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
BharathAMImpl am=(BharathAMImpl)pageContext.getApplicationModule(webBean);
if(pageContext.getParameter(“pempno”)!=null)
{
String hid = pageContext.getParameter(“pempno”).toString();
String whereclause = “EMPNO='”+hid+”‘”;
am.getEmployeeCreateVO1().setWhereClause(null);
am.getEmployeeCreateVO1().setWhereClause(whereclause);
am.getEmployeeCreateVO1().executeQuery();
}
else
{
am.InsertEmployeeRecord();
}
}
Now rebuild the code, rebuild the pages run the Employee Information Page, click on the Get Employee Information button and then click on the image item which is displayed on each available rows so that it takes us to create employee page but here it carries the row values. The sample output is shown in the below figure:


END







1 comment:

  1. 25% OFF on Oracle Apps R12 Financials Self Paced Course along with 11 Additional Add On Courses (321 Session Videos of 120 Hours Recordings). Our Top Trending Course with 1700 Enrolled Udemy Students

    Please Check https://www.oracleappstechnical.com for details

    ReplyDelete