7 Replies Latest reply on May 19, 2014 6:06 PM by Cuauhtemoc Amox

    Auto populate Lov in Dff based on previous Lov.

    Srinivas P

      Hi All,

       

      I have enabled a Dff in seeded OAF page,which contains 3 segments.

      Here req. is based on first 2 Lov's 3rd Lov should auto populate instead of again selecting the value manually.

      (Here the posiible values of  3rd Lov are Y or N or NULL).

      Is there any way to achieve this ?

      Please help me.....

       

       

      Thanks

      Srinivas

        • 1. Re: Auto populate Lov in Dff based on previous Lov.
          Hemant Garg

          Hi Srinivas  ,

           

          Yes this can be possible , create a custom table with value Y , N and Null , and also have two other column in the same table with values of lov1 and lov2 .

           

          like this ,

           

          create table dummy(col1 , col2 , col3);

          and values like this :-

          col1         col2              col3   

          lov1value  lov2value        Y

          lov1value  lov2value        N

          ........so on

           

          now create a valueset with this dummy table and assign to the 3rd segment , and in the default value again query from this dummy table depending on the lov1value and lov2 value .

           

           

          query would be like this :-

           

          select col3 from dummy where col1 =:$FLEX$.firstvalueset and col2 =:$FLEX$.secondvalueset .

           

          Please let me know if you face any issue in this ,

           

          Regards,

          Hemant

          • 2. Re: Auto populate Lov in Dff based on previous Lov.
            Srinivas P

            Hi Hemant,

             

            can we do it through OAF personalization?

             

            Thanks

            Srinivas

            • 3. Re: Auto populate Lov in Dff based on previous Lov.
              Hemant Garg

              yes , you can do it through OAF personalization also however for that you would have to extend the relevant CO of the page , then iterate through the rows of the DFFVO and set the value of the attribute in the processRequest method of the extended CO .

               

              Let me know if you want a sample code .

              • 4. Re: Auto populate Lov in Dff based on previous Lov.
                Srinivas P

                Please, send me the code.

                • 5. Re: Auto populate Lov in Dff based on previous Lov.
                  Hemant Garg

                  Hi ,

                   

                  here is the code however pls modify this as per your page details  , also replace this ContactExtraInfoVO with your page's dff VO .

                   

                  //write the below code in the processformrequest

                   

                  String lovInputSourceId = pageContext.getLovInputSourceId();  

                   

                  //here print the value of the lov when you tab out the 2nd segment lov and see this on frontend

                   

                  pageContext.writeDiagnostic(this , "The value of the second lov is :- "+lovInputSourceId , 2  );

                   

                  if(lovInputSourceId.equals("enter here the value of the second lov"))

                  {

                   

                  ContactExtraInfoVOImpl contactExtraInfoVO = (ContactExtraInfoVOImpl)localOAApplicationModule.findViewObject("ContactExtraInfoVO");

                  if (contactExtraInfoVO != null) {

                  ContactExtraInfoVORowImpl contactExtraInfoVORow = (ContactExtraInfoVORowImpl)contactExtraInfoVO.getCurrentRow();

                  pageContext.writeDiagnostics(this, "Hemant , the object of viewToBeExecuted :-" + viewToBeExecuted + "--has been found  ", 2);

                   

                  RowSetIterator conExInfoItr = contactExtraInfoVO.findRowSetIterator("conExInfoItr");

                  if (conExInfoItr != null) {

                  conExInfoItr.closeRowSetIterator();

                  }

                  conExInfoItr = contactExtraInfoVO.createRowSetIterator("conExInfoItr");

                  int rowCount = contactExtraInfoVO.getRowCount();

                  if (rowCount > 0) {

                  conExInfoItr.setRangeStart(0);

                  conExInfoItr.setRangeSize(rowCount);

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

                  contactExtraInfoVORow = (ContactExtraInfoVORowImpl)contactExtraInfoVO.getRowAtRangeIndex(i);

                  if(row.getAttribute1.equals("enter your value here ") && row.getAttribute2.equals("enter your value here"))

                  {

                  row.setAttribute3("Y") ;  //or set whatever value you want to set

                   

                  }

                   

                  }     

                   

                  }

                  }

                  }               

                  • 6. Re: Auto populate Lov in Dff based on previous Lov.
                    Hemant Garg

                    Hi Srinivas ,

                     

                    Did you try the above code , Please do let me know if it was of any help for your issue.

                     

                    Thanks

                    Hemant

                    • 7. Re: Auto populate Lov in Dff based on previous Lov.
                      Cuauhtemoc Amox

                      As Hermant mentioned, this is already achievable with normal setup using value sets and this would work on both forms and OAF. If you customize the page you'll have to reintroduce changes if they are ever patched.