Skip to Main Content

Set dynamic values to af:Query search params on pop-up load

Mahesh YNov 17 2019 — edited Nov 18 2019

Hello, I have a use case where on click of a button, I am displaying a pop-up and the contents in the pop-up is a query panel with results in a table. This query panel is created declaratively from a View Object. I had created a ViewCriteria with three attributes - all of them use bind variables with equals operator. Search on the query panel works fine.

However, I need to set the default values to the search attributes in the query panel and the values for the search attributes will be coming from the parent page(where I am clicking the button to fetch the popup). On Pop-up Fetch Listener, I tried to set the values using the following code, however, this doesn't seem to work:

        ViewObjectImpl empVO = (ViewObjectImpl) ADFUtils.findIterator("EmployeesVOIterator").getViewObject();

        ViewCriteria[] vcArray = empVO.getAllViewCriterias()

        ViewCriteria myVC = vcArray[0];

        ViewCriteriaRow vcr = (ViewCriteriaRow) myVC.get(0);

        for(int i=0; i < vcr.getAttributeNames().length; i++) {

            System.out.println(vcr.getAttributeNames()[i]);

            if("EmployeeId".equalsIgnoreCase(vcr.getAttributeNames()[i])) {

                System.out.println("EmployeeIdValue is: "+ vcr.getAttributeValues()[i]);

                vcr.setAttribute("EmployeeId", 102);

                System.out.println("EmployeeId Value after setting is: "+ vcr.getAttributeValues()[i]);

            }

        }

        System.out.println("Query is: "+empVO.getQuery());

        empVO.executeQuery();

I have been following this thread - How to set attribute in adf defalut search form query

Anyone faced a similar use case and can throw some light on how to achieve this? Appreciate any pointers. Thank you.

This post has been answered by Timo Hahn on Nov 18 2019
Jump to Answer
Comments
Post Details
Added on Nov 17 2019
2 comments
70 views