6 Replies Latest reply: Sep 5, 2013 6:23 AM by user11040901 RSS

    How to get new value from VO through CO?

    user11040901

      Hi,

       

      I have several tab in Po page. In the Lines Tab I change some values that I want to get in Distribution tab. This values aren't in the DB. How can I get it?

      I tried the following code but it didn't work

       

                               OAViewObject PoLineMergeVO = (OAViewObject)rootAM.findViewObject ("PoLinesMergeVO");

                               oracle.jbo.Row PoLineMergeRow =  PoLineMergeVO.first(); 

                               String s_category_id = PoLineMergeRow.getAttribute("CategoryId").toString();

       

      any idea?

       

      Best Regards Mayte

        • 1. Re: How to get new value from VO through CO?
          Shddn

          String valueOfBean=(pageContext.getParameter("id")!=null ? (String)(pageContext.getParameter("id"):(String)row.getAttribute("viewAttr")) // where id is id of ui bean and viewAttr is view attribute mapped to ui bean

           

          Ui beans should be not in table.

           

          Regards

          Shobhit S

          • 2. Re: How to get new value from VO through CO?
            user11040901

            Hi Shobhit,

             

             

            Thanks for reply. I'm going to explain my problem in detail.

             

            We have 2 lines fill in in the line grid. Every line have different values in the field PoLinesMergeVO.Category. This Tab have a own controller (OrderLinesTableRNCO). I want to get this values in the Distribution Tab, this tab have other controller OrderDistributionsCO.

             

            Could you help me???

             

             

            Best REgards Mayte

            • 3. Re: How to get new value from VO through CO?
              Shddn

              HI Mayte

               

              You need to iterate through view Object PoLineMergeVO to get all the values of PoLinesMergeVO.Category.

               

              You can store these values in some collection object. Now store this object in some session parameter.

               

              In next CO, get this session parameter to get collection object. Iterate trough collection object to get values of category.

               

              Regards

               

              Shobhit S

              • 4. Re: How to get new value from VO through CO?
                user11040901

                Hi Shobhit,

                 

                I'm new in OAF and I'm not sure if I know how to do it.

                 

                Could you tell how to store in collection object and store in session parameter????

                 

                I tried

                 

                CO 1

                              OAViewObject PoLineMergeVO = (OAViewObject)rootAM.findViewObject ("PoLinesMergeVO");

                              oracle.jbo.Row PoLineMergeRow =  PoLineMergeVO.first();

                                     

                              int num_row =   PoLineMergeVO.getRowCount();

                              String s_num_row = Integer.toString(num_row);

                              oapagecontext.writeDiagnostics(this,"Index Row--> "+s_num_row,1 );

                             

                              for (int i=0;i<5;i++)

                              {

                                String s_category_id = PoLineMergeRow.getAttribute("CategoryId").toString();

                               

                               //How to store in collection object --> XXXXXXXX

                                PoLineMergeRow =  PoLineMergeVO.next();

                              }

                 

                CO2

                 

                How I get Collection object??

                 

                Thanks a lot for your help.

                 

                Best Regards Mayte

                • 5. Re: How to get new value from VO through CO?
                  Shddn

                  HI Mayte

                   

                  You can iterate through PoLineMergeVO in second CO provided both CO are attached to region which share same application mdoule (ie you can get unstance of PoLineMergeVO in both CO and it should not be null)

                   

                  To iterate use

                   

                  OAViewObject viewObject =
                  (OAViewObject)am.findViewObject("PoLinesMergeVO") -- instance name
                  OARow row = null;
                  RowSetIterator itr = null;
                  if (viewObject != null && viewObject.isExecuted()) {
                  if (viewObject.findRowSetIterator("Iterator") == null) {
                  itr = viewObject.createRowSetIterator("Iterator");
                  } else {
                  itr = viewObject.findRowSetIterator("Iterator");
                  }
                  while (itr.hasNext()) {
                  row = (OARow)itr.next();
                  String category=String.valueOf(row.getAttribute("CategoryId"));
                  }
                  itr.closeRowSetIterator();
                  • 6. Re: How to get new value from VO through CO?
                    user11040901

                    Hi Shobhit,

                     

                    Thanks a lot, Mayte