Sunday, April 27, 2014

Check Box Support in ADF Query (11g R2 and 12c)

Few years passed since my previous post about check box support in ADF Query - Yes-No Check Box in Query Criteria. It was not working before, but there are improvements in the latest ADF releases. I will describe approach to handle multiple values from the same column, using check box in ADF Query. By default, you could render multiple values with choice list - but there is a way to use a group of choice lists (when column values will be known in advance).

Sample application -, implements ADF Query with a criteria to search by employee status. This status could be of three types - internal, external and consultant. All three check boxes are rendered in ADF Query, under Status group (check box with Internal status is ticked by default):

You could tick External in addition and bring both Internal and External employees:

Tick External and Consultant - this will bring different results:

Status for Internal, External and Consultant is set through Status field in Employee table:

As you can see, status is encoded through I, E and C values accordingly. This would mean, I would need to define three attributes in the VO, pointing to the same column in DB. Each attribute should handle different status. I would need to have LOV VO, to to define a check box. In order to simplify it and avoid creating three different VO's for each attribute LOV - I'm going to create only one VO with bind variable. This SQL query would always return bind variable value back - this is what I'm going to control through View Accessor:

We are done with LOV VO. There are three attributes defined in VO, based on the same EO attribute. Each attribute for different status:

Make sure to set attribute Control Type to be Check Box, before defining LOV. I'm using UI Category - EmployeeStatys, to group attributes in ADF Query:

Each status attribute is assigned with LOV. Keep in mind - each LOV is configured through different View Accessor (this is needed to pass a proper bind variable, based on a status represented by the attribute):

Here you can see an example - 'E' external flag variable is configured for View Accessor used in LOV configured for External employee status attribute:

UI groupings visible in ADF Query UI, are configured through UI Categories section in VO:

Check box for Internal status was ticked, using default value in View Criteria - 'I':

No comments: