4 Replies Latest reply: Mar 6, 2012 10:13 AM by user11165897 RSS

    OAF: passing value of one VO attribute to another VO

    user11165897
      Hai,

      I have a requirement to display a values of staff name and number from a (query, no EO) StaffSummaryVO1.
      Along with the page contains some other information.
      Now I need to save all these details including message styled text- display values to another main VO called StaffMgmtVO1.
      Both are store in only one root am.

      i have created a default single column RN with all data of StaffMgmtVO1.


      In page load i assign the values , and it shows correctly in PR:

      OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
      OAViewObject vo = (OAViewObject)am.findViewObject("StaffSummaryVO1");
      String enamevalue = vo.first().getAttribute("FullName").toString();
      String enovalue = vo.first().getAttribute("EmployeeNumber").toString();
      System.out.println("enamevalue is : " + enamevalue);
      System.out.println("eno is : " + enovalue);
      OAMessageStyledTextBean eName = (OAMessageStyledTextBean)webBean.findChildRecursive("StaffName");
      OAMessageStyledTextBean eno = (OAMessageStyledTextBean)webBean.findChildRecursive("StaffNumber");
      eName.setText(enamevalue);
      eno.setText(enovalue);

      PFR:

      super.processFormRequest(pageContext, webBean);

      if (pageContext.getParameter("ActionPlanSubmit") != null)
      {


      pageContext.getApplicationModule(webBean).invokeMethod("GetActionPlanNo",null);


      pageContext.getApplicationModule(webBean).invokeMethod("commitData",null);



      pageContext.setForwardURL("OA.jsp?page=/oracle/apps/fnd/framework/toolbox/tutorial/webui/HomePG",
      null,
      OAWebBeanConstants.KEEP_MENU_CONTEXT,
      null,
      null,
      true,
      OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
      OAException.ERROR);


      }


      But the PFR method is not executing .. How to save the page in ViewObject1 which displays the value of viewobject2.
        • 1. Re: OAF: passing value of one VO attribute to another VO
          SaurabhAg
          Hi,

          Say you have vo1 where you have the query which you execute during page load.

          Now you want to save some information to V02.

          Create your V02 and add the transient attributes to it like Col1, Col2.....

          On click of a button, capture the event in PFR.
          Call the function in AM "CopyRecords"

          CopyRecords
          =======
          Loop thru the records of Vo1 using FOR loop.
          Create a row in Vo2 and insert that row in Vo2.
          Set the attributes ( Col1, Col2) of VO2 using the values of Vo1.

          So now your VO2 will have the required data and you can use this VO in other pages.

          Let me know, if my understanding of your requirement is clear and if you need more detailed steps??

          Thanks
          Saurabh
          • 2. Re: OAF: passing value of one VO attribute to another VO
            user11165897
            yes ..this is the requirement.. i need the details steps please.

            Thanks
            • 3. Re: OAF: passing value of one VO attribute to another VO
              SaurabhAg
              Use this.

              PartyInfoVO --- A VO with the SQL which fetches Data.

              CopyVO --- VO with the transient variable which is updateable = ALWAYS and queryable = CHECKED.

              I am copying the PartyName from PartyInfoVO to CopyVO using the below code.

              public void copyRecords()
              {
              PartInfoVOImpl vo = getPartInfoVO1();
              PartInfoVORowImpl row = (PartInfoVORowImpl)vo.first();
              CopyVOImpl copyVo = getCopyVO1();

              // Looping through the PartyInfoVO so that, we can copy data to CopyVO

              while(row!=null)
              {
              System.out.println("Creating new Row for Party Name : " + row.getPartyName());
              if(!copyVo.isPreparedForExecution())
              {
              copyVo.executeQuery();
              }
              copyVo.setMaxFetchSize(0);
              CopyVORowImpl copyRow = (CopyVORowImpl)copyVo.createRow();
              copyRow.setPartNameTransient(row.getPartyName());
              copyVo.insertRow(copyRow);
              row = (PartInfoVORowImpl)vo.next();
              }

              // Trying to print the data copied in CopyVO

              CopyVOImpl copyVo1 = getCopyVO1();
              System.out.println("Total rows copied : " + copyVo1.getRowCount());
              CopyVORowImpl copyRow = (CopyVORowImpl)copyVo1.first();
              while(copyRow!=null)
              {
              System.out.println("Copy Row Party Name : " + copyRow.getPartNameTransient());
              copyRow = (CopyVORowImpl)copyVo1.next();
              }

              Hope this helps !

              Thanks
              Saurabh
              • 4. Re: OAF: passing value of one VO attribute to another VO
                user11165897
                Hai,

                It is working now..Thanks for ur help.

                When i use VORowImpl class (as u suggest) i got the result.
                Usually i used the following code in these cases. But this time i dont get the values. if u know pls clarify.


                public void GetHeaderID()
                {


                DtrHeaderVOImpl vo = getDtrHeaderVO1();
                oracle.jbo.Row row = vo.getCurrentRow();
                if(row != null)
                {
                String HeaderId = row.getAttribute("DtrHeaderId").toString();

                System.out.println("header id in getatributes: "+HeaderId);
                DtrLinesVOImpl vo1=getDtrLinesVO1();
                oracle.jbo.Row row1=vo1.getCurrentRow();

                row1.setAttribute("DtrHeaderId",HeaderId);
                System.out.println("DtrHeaderIdHeaderId for lines :");
                }

                else
                throw new OAException("null values",OAException.INFORMATION);



                }


                Output: null values;



                Regards,
                Teja