12 Replies Latest reply on Jun 10, 2014 12:52 PM by Ludovic Mazzei

    Fetching View object

    Ludovic Mazzei

      Hello,

      I have created a custom page divided in 2 parts.

      - first part, this is a query region  (construction Mode : autoCustomizationCriteria)

      - second part, Query components( with a Simple Search  Panel and a simple search Mappings).

       

      The search page works correctly and display correct results.

       

      The problem encountered is that When I fetch my view object, I fetch all the lines without taking in consideration the criteria entered in the Query panel.


      Here is the source code of my Page Controler



        public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

        {

          super.processFormRequest(pageContext, webBean);

       

        

          OAApplicationModule oam = pageContext.getApplicationModule(webBean);

       

          reffournAMImpl reffournamimpl = (reffournAMImpl)oam;

       

          System.out.println("**** #rows="+reffournamimpl.getRefFournVO1().getRowCount());    //// Returns the max value defined in the profile option : FND: View Object Max Fetch Size

        

       

                                    RefFournVOImpl copievoimpl = reffournamimpl.getRefFournVO1();

                                    RefFournVORowImpl copietovorowimpl = (RefFournVORowImpl)copievoimpl.first();       

                                    //

                                    for(; copietovorowimpl != null; copietovorowimpl = (RefFournVORowImpl)copievoimpl.next())

                                        {

                                           ....

                                         }

        }

       

       

      In the application, I receive a warning message:

       

      Warning

       

      1. Query has exceeded 2000 rows. Potentially more rows exist, please restrict your query.

       

       

      Note1 : 2000 is the value defined at site level for profile option FND: View Object Max Fetch Size

       

      Note2 : My data selection returns only 4 lines (in the result panel)

       

      That seems that the View Object is not correctelly initialized.

       

       

      Thanks a lot for your precious help.

      Best regards,

      Ludovic

        • 1. Re: Fetching View object
          mkhan983

          Hi Ludovic,

           

          Please verify if you have queryCriteriaMap item defined (for every query panel item) --> in order to restrict the fetched VO values as per the user input in Query panel.

           

          Also verify if you have correct values in 'Search Item' and 'Results item' property of every queryCriteriaMap item. You must be missing something here, that could be the reason why the Search VO is not restricting the displayed data.

           

          Regards,

          Zahid

          • 2. Re: Fetching View object
            Ludovic Mazzei

            Hi Zahid,

            Thank you very much for your help.

            So I have in the 'query component' folder   :

               - a simpleSearchPanel  : With the list of filters.

               - a simpleSearcheMapping :  To map each filter's field  with the iten in the result tab.

             

            Just to be sure, that I have correctly explained ma problem:

            On the application, If I want to filter with a field (purchase number for example) the result appears correctly in the result tab (3 lines for examples)

             

            Then I want to fetch theses 3 lines to update a field.

            But in the controller when I fetch my VO, I have too much lines   and not 3.

             

            However, I followed, your advices and check the values for the 'Searc Item'   and the corresponding mapping.

            Every thing seems ok.

             

            Thank you again.

            Best regards,

            Ludovic

            • 3. Re: Fetching View object
              mkhan983

              On the application, If I want to filter with a field (purchase number for example) the result appears correctly in the result tab (3 lines for examples)

               

              Then I want to fetch theses 3 lines to update a field.

              But in the controller when I fetch my VO, I have too much lines   and not 3.

              Hi Ludovic,

               

              It seems you are getting correct VO value on the Advance Table when you're selecting Search criteria in Query Panel.

               

              Now, can you try performing the fetching operation inside GO button handle? Share the result of the below code:

               

              In processFormRequest:

               

              String idGo = queryBean.getGoButtonName();

              if (pageContext.getParameter(idGo) != null) { //clicking the Go button, this event will fire.

               

                      OAViewObject vo1 =
                         

              (OAViewObject)am.findViewObject("YOUR_VO1");

              System.out.println("**** #rows="+vo1.getFetchedRowCount()); 

              }

               

              Also, try using getFetchedRowCount() method while fetching the VO value instead of getRowCount() method.

               

              Thanks,

              Zahid

              1 person found this helpful
              • 4. Re: Fetching View object
                Ludovic Mazzei

                Hi Zahid,

                 

                1.

                 

                In ProcessFormRequest,

                I have added :

                ///Oracle communities
                OAQueryBean queryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN"); 
                String idGo = queryBean.getGoButtonName();

                 

                if (pageContext.getParameter(idGo) != null) {
                //clicking the Go button, this event will fire.
                OAViewObject vo1 =  (OAViewObject)oam.findViewObject("RefFournVO1");
                System.out.println("**** #FetchedRowCount="+vo1.getFetchedRowCount());  
                }

                ==> The result is

                14/06/03 13:54:39 **** #FetchedRowCount=0

                 

                 

                I have checked that "QueryRN" is the id of my query region.  This is not the id of the SimpleSearchHeader neither the ID of the simpleSearchMapping. This is right ?

                 

                 

                2.

                In my previous code, I have replaced getRowCount() method  by getFetchedRowCount().

                The result is

                14/06/03 13:55:03 **** #rows=0

                 

                Instead of   **** #rows=2001     (previously).

                 

                 

                 

                Thanks again for your valuable help,

                Best regards,

                Ludovic

                • 5. Re: Fetching View object
                  mkhan983

                  Hi Ludovi,

                   

                  Thanks for sharing the results. Please try the following:

                   

                  We are witnessing the getFetchedRowCount() value after the GO (search) button event. I replicated the same scenario locally and was getting the same result.

                   

                  Now, lets say you want to fetch the search values of any of the table attributes (VO attributes after Search). You can do this at any post Search event. In my local testing, I took a Submit button and tried with the below code:

                   

                  if (pageContext.getParameter("CheckValue") != null) { // "CheckValue" --> Id of Submit button

                  OAViewObject vo1 =

                       (OAViewObject)am.findViewObject("TestVO1");

                  System.out.println("#####FetchedRowCount=" + vo1.getFetchedRowCount());

                  Row row = vo1.first();

                  System.out.println("#####TrailerNumber=" + row.getAttribute("TestVal"));

                  }

                   

                  Output:

                  #####FetchedRowCount=1

                  #####TrailerNumber=Test_Value1

                   

                  The table displayed only one result and hence the getFetchedRowCount() output was 1. Similarly, post Search try capturing the VO attributes in any specific event (Save button, etc). Revert for any issues.

                   

                  Hope it helps.

                   

                  Regards,

                  Zahid

                  1 person found this helpful
                  • 6. Re: Fetching View object
                    Ludovic Mazzei

                    Hello Zahid,

                    Thank you again for your help.

                     

                    In my result table, I have added a button to propage an information.

                    Now the FetchedRowCount is different than 0.  That's better.

                    On the Search Screen, I enter a criteria, the result table prints 3 lines.

                     

                    On the Propagate button I have pasted (your code):

                     

                     

                                  //clicking the Go button, this event will fire.     

                                  OAViewObject vo1 =  (OAViewObject)oam.findViewObject("RefFournVO1");

                                  System.out.println("**** #2#FetchedRowCount="+vo1.getFetchedRowCount());  

                                  //

                                  Row row = vo1.first();

                                  System.out.println("#2#####Description=" + row.getAttribute("Description"));

                                  row = vo1.next();

                                  System.out.println("#2#####Description next=" + row.getAttribute("Description"));

                                  row = vo1.next();

                                  System.out.println("#2#####Description next=" + row.getAttribute("Description"));

                                  row = vo1.next();

                                  System.out.println("#2#####Description next=" + row.getAttribute("Description"));

                                  row = vo1.next();

                                  System.out.println("#2#####Description next=" + row.getAttribute("Description"));

                                  row = vo1.next();

                                  System.out.println("#2#####Description next=" + row.getAttribute("Description"));

                                  row = vo1.next();

                                  System.out.println("#2#####Description next=" + row.getAttribute("Description"));

                            ///

                     

                    As you can See, I fetch the VO (7 times)

                    The output prints :

                     

                    14/06/04 11:26:07 **** #2#FetchedRowCount=1

                    14/06/04 11:26:07 #2#####Description=CARTOUCHE JET D'ENCRE HP PHOTOSMART 8250 NOIR 363XL C8719EE

                    14/06/04 11:26:07 #2#####Description next=PAPIER TOP-LINE PLUS POUR JET D'ENCRE  120GRS REF: 1210R04 EMBALLE A L'UNITE

                    14/06/04 11:26:07 #2#####Description next=POCHE D'EXPEDITION POUR CD-ROM EN CARTON DE 500 GM2 (EMB. DE 10)

                    14/06/04 11:26:07 #2#####Description next=ENCRE EPSON NOIR POUR STYLUS COLOR/PRO/XL/+ - RÉF. S020034

                    14/06/04 11:26:07 #2#####Description next=ENCRE  NOIR HP POUR DESKJET 700/800C/870/930/940/970/990/1100/1120/1150C/895/6127 - NO 51645A

                    14/06/04 11:26:07 #2#####Description next=TONER KYOCERA NOIR POUR FS-1800/1800+/3800 - RÉF. TK-60H

                    14/06/04 11:26:07 #2#####Description next=TONER HP NOIR POUR LASERJET II/IID/ III/IIID - RÉF. 92295A

                    14/06/04 11:26:07 **** Dans la méthode copyColonne

                    14/06/04 11:26:07 **** xxColonne=D, mettre :10

                     

                     

                     

                    So This result confirms the problem.

                    I have only 3 lines in the result table, But When I fetch the VO, I havec more than 3 lines.

                    That seems that the selection parameters are not taken in consideration.

                     

                    What is wrong in my source code ?

                     

                     

                    Thank you,

                    Best regards,

                    Ludovic

                    Ludovic

                    • 7. Re: Fetching View object
                      mkhan983

                      Hi Ludovic,

                           //clicking the Go button, this event will fire.      

                                    OAViewObject vo1 =  (OAViewObject)oam.findViewObject("RefFournVO1");

                                    System.out.println("**** #2#FetchedRowCount="+vo1.getFetchedRowCount());  

                                    //

                                    Row row = vo1.first();

                                    System.out.println("#2#####Description=" + row.getAttribute("Description"));

                                    row = vo1.next();

                       

                      The code snippet I provided was only for my testing purpose while replicating your scenario.

                       

                      Use the below code snippet on any event to capture the value of VO "Description" attribute based upon User Search criteria.

                       

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

                      OAViewObject vo1 =

                           (OAViewObject)am.findViewObject("RefFournVO1");

                      System.out.println("#####FetchedRowCount=" + vo1.getFetchedRowCount());

                      System.out.println("#####RowCount=" + vo1.getRowCount());

                       

                      int totalRecord = vo1.getRowCount();

                      Row row = vo1.first();

                      for (int i = 0; i < totalRecord; i++) {

                      String Value = row.getAttribute("Description").toString();

                      System.out.println("Description = " + Value);

                      row = vo1.next();

                      }

                      }

                       

                      Reply for any issues.

                       

                      Thanks,

                      Zahid

                      • 8. Re: Fetching View object
                        Ludovic Mazzei

                        Hello Zahid,

                         

                        The value of   totalRecord = 2001.

                        And this is the problem.

                         

                        Why it isn't 3 (as the number of lines in my result table) ?

                         

                        Best regards,

                        Ludovic

                        • 9. Re: Fetching View object
                          mkhan983

                          Hi Ludovic,

                           

                          Just for testing purpose, please create a button in your page and try the code snippet shared above. Also, share the results. Until then, I will try using the code in propagate button (next, etc) and try to find a solution.

                           

                          Thanks,

                          Zahid

                          • 10. Re: Fetching View object
                            Ludovic Mazzei

                            Hi Zahid,

                             

                            Perhaps I did not understood correctly, but I have already tried the code snippet shared above.

                            I have assigned it to my button 'propagate', this button appears for each lines.

                             

                            You ask me to create a button in my page....but my propagate button is this button.

                             

                            You probably want to test a specfic situation but I don't see wich one.

                            You want me to create a button at the end of my page instead of create a button at line level so repeated as many times as there are lines ?


                            Please could you confirm ?


                            Thank you

                            Ludovic

                            • 11. Re: Fetching View object
                              mkhan983

                              Hi Ludovic,

                               

                              Apologies for the late reply. Yes, I was asking you to test the above code snippet with one button on the page after the Search is performed. I will try to test the same with your requirement (Propogate button --> on every row of the Search display table).

                               

                              Thanks,

                              Zahid

                              • 12. Re: Fetching View object
                                Ludovic Mazzei

                                Hi Zahid,

                                 

                                Sorry for the delay, Yesterday it was a public holiday.

                                So I have executed today your action plan.

                                 

                                1. Creation of a unique button 'testbbtn' after the result table.

                                     I have added your snippet code, in the process form request.

                                2. I do the search, it returns 3 lines

                                3. I click on testbtn  button, the snippet code is executing.

                                4.   FetchedRowCount=0

                                      RowCount=2001.

                                 

                                This is the same behaviour than previous (when the button is at line level).

                                 

                                Best regards,

                                Ludovic