• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Dynamic Changes in OAF pages

In this lesson we are going to see how to change the same page behavior dynamically.

For example in our project if we look at the functionality whenever we click on the Detail page all the patient details are showing but all are showing in Editable format and moreover the add button is also in active stage whenever we click on Detail image in search page.

So therefore here our requirement and our task is whenever we click on Detail logo all the items and data must be only in Read only stage and also the Add button must be in Disable mode.

To achieve these dynamic change in OAF pages follow the steps:

  1. Edit the Patient Entry page VO.
  2. Create one transient attribute in the VO.

Transient attribute in OAF is nothing but the attribute value which is not in the Oracle Data Base table. We know that while creating VO all the Columns of table will be converted into Attributes or we call columns as attributes in VO, so therefore transient attribute is one which we create temporarily to display some results which will not effect data base tables.

For example Student marks are saved in different columns but in data base assume that we are not maintaining any column for total marks sum but if we want  the total value to be displayed in OAF form so therefore for that we will create on temporary or duplicate attribute value to hold total marks.

Let us see how to create transient attribute in OAF according to our requirement:

Edit the VO as shown in the below figure:

Slide1

Right click on VO and select Edit PatientEntryVO or double click on the VO to open it.

After opening the VO select the Attributes value in left side as shown in the below figure:

Slide2

Select New button which is located down to the attributes list, After selecting New button give new attribute name, Type as Boolean, and in Updatable select a Radio Button option called Always, for example see the below picture:

Slide3

Click on Ok button later click on Apply and Ok button in View Object so that the transient attribute will be created.

After creating transient attribute now create one SPEL value basing on patient entry vo, because we need to do dynamic changes in this page only:

${oa.PatientEntryVO1.xxReadOnly}

After creating SPEL pass this SPEL value in each and every item of a Patient Entry page region, pass the SPEL value to all the items those we want them to act as a read only values, note that we cannot pass this SPEL value directly to region because of that reason we have to pass in each item, now the question rises where to pass SPEL value:

Pass the SPEL value in :

-> Select XML page and in page structure select the item.

-> In the property inspector Functional -> Read Only, here we will find True and False.

-> Remove the current existing True/False value and place the SPEL value which we created here.

pass the SPEL values to all the items and even to ADD button item.

After adding the SPEL value go to AM and add the following additional line in the AM method which we created to add patient as follows:

public void xxinsertpatient()

{

PatientEntryVOImpl vo= getPatientEntryVO1();

OADBTransaction trans= getOADBTransaction();

vo.executeQuery();

Row v_row = (Row)vo.createRow();

vo.insertRow(v_row);

//the below one is the additional line code

v_row.setAttribute(“xxReadOnly”,Boolean.FALSE);

}

In the Controller class add the following code, in code “ppatientid” is the parameter value of detail icon which we already seen in the previous lessons so additionally we are adding three lines which are:

if(pageContext.getParameter(“ppatientid”)!=null)

{

String pid = pageContext.getParameter(“ppatientid”).toString();

String whereclause = “PATIENT_ID='”+pid+”‘”;

am.getPatientEntryVO1().setWhereClause(null);

am.getPatientEntryVO1().setWhereClause(whereclause);

am.getPatientEntryVO1().executeQuery();

// add the following lines

 OAViewObject vo=(OAViewObject)am.findViewObject(“PatientEntryVO1”); Row row= vo.first(); row.setAttribute(“xxReadOnly”,Boolean.TRUE);

}

Rebuild the code and run the page and see the output, the below figure shows the search page output and the second image shows the dynamically changed page which is actually the patient entry page:

Slide4

Click on Detail Image icon in the search list:

Slide5

 

 

Summary
Review Date
Reviewed Item
Dynamic Changes in OAF pages
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Dynamic Changes in OAF pages"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.