1 Reply Latest reply: Nov 19, 2012 11:00 AM by shreevat RSS

    MessageCheckBox not working on executeQuery

    587448
      Hi all,

      I have a requirement in OAF,where I have a search page.Each row of the results table (when clicked GO) will have a checkbox associated with it.The rows for which the checkboxes are selected will get saved in another table.
      The search page is driven by two fields amongst the other fields---1. a from date field and 2. a to date field.
      The value from this two field is taken and used in setWhereClause condition to drive the search.
      For the check box I have used a transient attribute(*ViewAttr*) with 1.Passivate 2.Queriable and 3.Update Always selected.I have made this transient attribute in the same VO that is used in the Results Table of the Query Region.
      A button(*itemID:ADD*)is temporarily added to check wheter the rows with the checkboxes ticked are selected/detected.this is done by doing getAttribute on the Transient Attribute.

      Issue:Whenever the GO button is clicked and the SetWhereClause is executed and after that the check boxes are selected and I press the ADD button,the transient attriute returns a null value.But this does not happen when the executequery() line is commented out in the VOIMPL.
      I have used the following code to check how many rows are getting selected i.e how many rows are checked.



      if (pageContext.getParameter("ADD") != null)

      {
      OAViewObject vo = (OAViewObject)am.findViewObject("XXECMSSICKVO1");
      long fetchedRowCount = vo.getEstimatedRowCount();
      System.out.println("Number of rows is "+fetchedRowCount);
      OARow row=(OARow)vo.first();

      for(i=0;i<fetchedRowCount;i++)
      {
      result=(String)row.getAttribute("ViewAttr");

      //result=(String)pageContext.getParameter("ViewAttr");

      System.out.println("result is "+result);
      if(result==null)
      {
      result="N";
      System.out.println("Inside null check "+i);
      }
      System.out.println("the value of CB is "+result);
      if(result.equals("Y"))
      {
      count=count+1;

      SicknessType=(String)row.getAttribute("SicknessType");
      System.out.println("get attr is "+SicknessType);
      }

      else
      {
      count=count+0;
      }
      row=(OARow)vo.next();
      }

      System.out.println("Count is "+count);

      }

      Can please tell me why is this happening and how to resolve this issue......its urgent........

      Thanks
      Souri
        • 1. Re: MessageCheckBox not working on executeQuery
          shreevat
          I assume you havve followed these steps.

          1. Created a table with multiple selection for displaying the results.
          2. Added a string transient attribute (say MultiSelectBN) to the results VO and associate it with the above multi select bean.
          3. You can use the below to identify selected rows.

          OAViewObject vo1 = (OAViewObject)am.findViewObject("<VO Name>");
          Row[] selectedRows=vo1 .getFilteredRows("MultiSelectBN","Y");
          int numRows=selectedRows.length;
          if (selectedRows != null && numRows > 0)
          {
          for (int i = 0; i < numRows; i++)
          {
          -- your logic to call AM or whatever
          }
          }

          Thanks
          Shree