Thursday, August 15, 2013

Multiple Choice Support in ADF BC View Criteria

It happened to see while reviewing ADF projects people are using complex implementation to allow search on multiple values. Same is available out of the box, I would like to share with you - may be it will save time during your next use case implementation.

Sample application - ADFQueryMultipleChoiceApp.zip, implements choice list LOV for Job ID attribute:


Job Id attribute is included into View Criteria as search item. Make sure to set search operator as Equals, otherwise LOV will be ignored and simple input text will be rendered:


Still in View Criteria wizard - go to UI Hints tab and make sure to select check box - Support Multiple Value Selection for JobId attribute. This will inform ADF runtime to render multi choice support in ADF query field:


This is how it looks on runtime - we can choose multiple value for Job Id - all them will be added to the query:


Data is filtered accordingly - employees with different Job Id's are included:


On SQL level - each value is added as separate bind variable:


And appended to the SQL statement WHERE clause:

15 comments:

Apostolos Kitsopoulos said...

Very nice feature. Thanks a lot Andrejus for bringing this up.

But, suppose I use a Programmatic VO with corresponding LOVs in the fields in order to filter my table instead of the VC. How can I achieve this in that case?

Regards
~apostolos

Andrej Baranovskij said...

This sounds a different use case.

Andrejus

BradW said...

This is so cool! I keep being amazed about what you find around the corner in different tabs in ADF.... Thanks for sharing!

Andrej Baranovskij said...

Thanks for great feedback ! :)

Ahmad Al-Zamer said...

about the comment I left earlier today about the error I get when I tried the application on jdeveloper 11.1.1.5 .
When I migrated the application to Jdeveloper 11.1.2.3 as is ,It worked without any issues.

Andrej Baranovskij said...

It works across all version of ADF, as I know.

Andrejus

Unknown said...

hi andrejus greetings from México.
I have a field with a list of values ​​that is dependent to a field with multiple selection, can refine the bound field based on multiple selections?

rachelin said...

Hi,

Is there a way to set default value when using "support multiple value selection?"

Thanks.

Santhosh said...

Dear Andrejus,

I am facing a problem while using the multiple choice in the af:query based search.
I used the same application as posted by you. But added a tooltip text for the field 'JobId' which has been incorporated with the multiple choice selection.

Now if i run the page,
in search, if i point my cursor on to the 'JobId' field it will show the tooltip.

Problem Definition:
After placing the cursor onto some other field in the search, the tooltip displayed for the 'JobId' will never be disappeared.

This happens only with the field incorporated with multiple choice otherwise it works fine.

Please help me in fixing this problem.

-Santhosh

Mahesh said...

Andrejus,

It's a very good article. I have a question. Is there a way we can default a value for the select many choice component even before the page loads so we have a value selected in the page once it is loaded?

Thanks,
Mahesh

asgs said...

Thank you!

Anonymous said...

Where can I download it? The link is broken.
Thank you.

Andrej Baranovskij said...


You can download all old samples from here - https://code.google.com/archive/p/jdevsamples/downloads

Hurdaya Aalapana said...

Hi Andrejus,
I have a requirement as follows.
In the header portion a search criteria is displayed with 5 attributes and below table will be result based on the above search parameters.
Now I have added two new attributes to this view criteria in the VO and now total 7 attributes are part of the View Criteria. On the run time we have to check the flag and if flag = true then we hav to include above two new attributes in to the View Criteria , otherwise no.
Please let me know how we can handle such situation.
thanks in advance

Anonymous said...

Hi Hurdaya Aalapana,
i have the same requirement , do you find a solution ?