9 Replies Latest reply on Apr 29, 2014 7:59 AM by Jon632

    How to refer to a queried value?

    Jon632

      Hi!

      I have a master/detail page but not using ViewLink (I got error the first time I tried using it). What I need to do is to query the detail table based on the header_id (common column )of the master table but the search criteria is based on another column. So, when I successfully queried a master, I need to refer to the header_id column of the master and use this as the parameter in the query of the detail table. How will I do this?

       

      thanks.

        • 1. Re: How to refer to a queried value?
          fsl

          Hi,

           

          I am not sure why you are not using the ViewLink for your requirement.

          What error do you get when using viewlink and if you are not using view link how are you going to show the detail records related to master records?

           

          Br,906099

          • 2. Re: How to refer to a queried value?
            Jon632

            After querying the master record, I also manually query the detail record, with this I am able to simulate a master/detail mechanism "manually". I should be trying again using ViewLink. Anyway, my immediate requirement now, not just for master/detail, is to be able to refer to an attribute of a previously queried vo. I guess it has something to do with getAttribute but my still little knowledge of jdeveloper is stopping me from comprehending well. Hopefully you can help me.

             

            thanks.

            • 3. Re: How to refer to a queried value?
              fsl

              Hi,

               

              I am not sure how are you trying to implement this.

              But you can get the handle of the row on some event for that you will have to create an event on the item.

               

              Here is the code which might help you in some way:

                      String rowRef =
                          pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
                      OARow row = (OARow)am.findRowByRef(rowRef);

                           String header_id=row.getAttribute("header_id");

               

              Br, 906099

              1 person found this helpful
              • 4. Re: How to refer to a queried value?
                Jon632

                Thanks. I'll try it out.

                • 5. Re: How to refer to a queried value?
                  Jon632

                  Hi!

                  I tried it using the following code but gave me runtime java.lang.NullPointerException error. Maybe I am not pointing to a particular record...

                   

                    if (pageContext.getParameter("Go") != null) {
                       String AccountNoStr = null;
                       AccountNoStr = pageContext.getParameter("SearchAcctNo");

                   

                       if (AccountNoStr == "" )
                          {   
                          throw new OAException("No search criteria entered", OAException.INFORMATION);   
                          }
                       else
                          {
                          ChargingHeaderAMImpl am = (ChargingHeaderAMImpl)pageContext.getApplicationModule(webBean);   
                          am.PressGoBtnEvent(AccountNoStr);   
                        
                          String rowRef =  pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
                          OARow row = (OARow)am.findRowByRef(rowRef);
                            
                          Object header_id = row.getAttribute("HeaderId");
                       }

                  PressGoBtnEvent queries the vo... Do I have to position my record pointer to the first record after querying? If that is so, how to do it?

                   

                  Thanks.

                  • 6. Re: How to refer to a queried value?
                    Jon632

                    This code is in my PFR...

                    • 7. Re: How to refer to a queried value?
                      Jon632

                      It is also worth noting that in my ChargingHeaderAMImpl, there are 2 VOs attached (master and detail). So, how will I tell that I want to get the header_id of the master vo's first record (which is always consist of only 1 record)?

                       

                      thanks.

                      • 8. Re: How to refer to a queried value?
                        919822

                        "But you can get the handle of the row on some event for that you will have to create an event on the item."


                        Did you created EVENT on any column in the Header Table? If not, on what event you are trying to query the detail VO?


                        "PressGoBtnEvent" -> I assume it is the event on your search region. If query return multiple rows and if you always want to display details for the first header row then use vo.first() and getCurrentRow methods to refer HeaderID.





                        • 9. Re: How to refer to a queried value?
                          Jon632

                          Hi! Since I cannot make ViewLink to work for me (I probably need some more research...), I am just manually querying the detail vo right after I queried the master vo. This is the reason why I'm looking for the current (and only) record in the master to get and be able to pass HeaderId (common attribute to the two) into the detail vo's query via setWhereClause. I was able to do that with the below routine:

                           

                          public void PressGoBtnEvent(String AccountNo) {   
                             ChargingHeaderVOImpl voHeader = (ChargingHeaderVOImpl)getChargingHeaderVO1();   
                             voHeader.initHeaderQuery(AccountNo);      

                           

                             voHeader.first();
                             Row currow = voHeader.getCurrentRow();
                             Number HeaderId = (Number)currow.getAttribute("HeaderId");
                            

                           

                           

                          Thanks.