4 Replies Latest reply: Jul 2, 2013 1:27 PM by user2615117 RSS

    How to insert arrayList<String> dynamic values into adf rows

    user2615117

      Hi All,

      Using Jdeveloper 11.1.2.3.0  - java 7

      I have table with two columns. The first column is UnqId, the second one for dynamic strings from ArrayList<String>.

      Two public boolean methods in ViewImpl class check UnqId and assign dynamic strings for rows.

      The logic is: If isCaseABC(UnqId) return true then row value is "ABC", else if isCaseDEF(UnqId) return true, set row value "DEF", else "END"

       

      I failed to display the strings, the code below return all rows displayed the last string "END" while the rows should be in all cases for "ABC", "DEF", "END"

      The last string overwrites all previous strings.

      Please help!

       

      Thanks

       

      the RichOutputText outputTextMsg has binding with getter() and setter()

       

      public void test()
       { 
            String string = "";
            ArrayList<String> strArray = new ArrayList<String>();
            ViewObject vo;
            Row[] rows = vo.getAllRowInRange();
            for(int i = 0; i < rows.length(); i++)
                 {
                      Number number = (Number)rows[i].getAttribute("UnqId");
                      if(isCaseABC(number))
                           {
                                string = "ABC";
                                strArray.add(i,string);
                           }
                      else if (isCaseDEF(number))
                           {
                                string = "EDF";
                                strArray.add(i,string);
                           }
                      else
                           {
                                string = "END";
                                strArray.add(i,string);
                           }
       
       outputTextMsg.setValue(strArray.get(i);
        }
       }
       
      

       

      jspx:

      <af:column headerText ="Test" id = "c1">

         <af:outputText value="#{backing_bean.outputTextMsg} id="c1"/>

      </af:column>

        • 1. Re: How to insert arrayList<String> dynamic values into adf rows
          prateekazam

          Hi ,

           

          You can do this in ADF business component through groovy.

           

          for example
          if(adf.newValue){

          }

           

          newValue will give the attribute newValue thereafter you can apply your validation.

           

          Thanks

          Prateek

          • 2. Re: How to insert arrayList<String> dynamic values into adf rows
            user2615117

            Thanks but that doesn't work

            I am trying to use ArrayList<Integer> to store the index of table for each sinario.

            Might be like this:

             

            ArrayList<Integer> integerArr = new ArrayList<Integer>();

            for(int i = 0; i<rows.length();i++)

            {

              Number number = (Number)rows[i].getAttribute("UnqId");

              if(isCaseABC(number))

                {

                   int a = i;

                   integerArr.add(a);

                 }

            -----------------------------
            }

             

             

            another for loop

            if(ingegerArr.size>0)

            {

                 for(int x = 0; x< integerArr.size; x++)

                {

                   this.ouputTextMsg.setValue();     // I am here, working on this line

                 }

            }

             

             

            Thanks

            • 3. Re: How to insert arrayList<String> dynamic values into adf rows
              Frank Nimphius-Oracle

              Hi,

               

              the following line

               

              1. public void test() 
              2. {  
              3.       String string = ""; 
              4.       ArrayList<String> strArray = new ArrayList<String>(); 
              5.       ViewObject vo; 

               

              doesn't make sense to me as the VO appears to be uninitialized.So I am not surprised if nothing works.

               

              Another problem is

               

              <af:column headerText ="Test" id = "c1">

                 <af:outputText value="#{backing_bean.outputTextMsg} id="c1"/>

              </af:column>

               

              This always reads the same data and does not show row instance specific data. Also,"ouputTextMsg" seems to be the component binding reference (according to this.ouputTextMsg.setValue(); ), which means that you reference a component binding as the component value.

               

              Too many loose ends in your code that need fixing first

               

              Frank

              • 4. Re: How to insert arrayList<String> dynamic values into adf rows
                user2615117

                Thanks for your help,

                 

                I would be surprised too if something works with this uninitialized ViewObject vo :-).

                Actually I removed some lines of code but it seems I removed too many. :-)

                 

                To my current code the ViewObject vo is initialized with DCIteratorBinding and getViewObject(). So that is working fine, I don't have any problem with it.

                 

                The issue I get is I failed to set up the dynamic strings for <af:column> <af:outputText value="#{backing_bean.outputTextMsg}"/> </af:column>

                I bind the outputText in backing_bean so that value will be flexible for different scenarios.

                 

                I am still working on it, much appreciate if you give some advice.

                 

                Thanks