Monday, October 28, 2013

Invoking sequence in OAF Page


Invoking sequence in OAF Page



To invoke the sequence number in the OAF page then write the following code in the setter method of the required column in EOImpl.java file.




//For Copy Paste//

    public void create(AttributeList attributeList) {
        super.create(attributeList);
       
          OADBTransaction transaction = getOADBTransaction();
      // To get the employee id  through sequence
          Number employeeId = transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");
          setEmployeeId(employeeId);

         
// Start date should be set to sysdate
        setStartDate(transaction.getCurrentDBDate());
        // end create()
 }



OR
If you want to write in controller write the below code in processRequest of controller class.

          OADBTransaction transaction = (OADBTransaction)am.getOADBTransaction();
          Number seqvalue= transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");  
          System.out.println("seqvalue-->"+seqvalue);       
          OAMessageStyledTextBean mcb = (OAMessageStyledTextBean)webBean.findChildRecursive("EmpId");
          mcb.setValue(pageContext,seqvalue);

The Desired output shulde like.