JDEV: af:query hide some attributes from query panel but show them in the result table

An interesting question came up today in the OTN JDev forum. The use case is to use an af:query component to qurey a db table, but make some of the attributes available in the table invisible in the query panel.
You can archive this using viewCriteria, but in this case you still can reach the other attributes in advanced mode.
The way to go is to make the attribute which you want to hidenot queryable in the view definition. For this we open the VO and select the attribute node.

Queryable Attribute in a VO

Queryable Attribute in a VO

Here we remove the check mark from the ‘Queryable’ checkbox like I did for the JobId attribute in the picture below

Not queryable attribute in a VO

Not queryable attribute in a VO

Now when we use this VO in a af:query component we see all queryable attributes but not the ones where we removed the check box. In the sample I removed the checkmark for JobId, ManagerId and DepartmentId in the EmployeesView. The resulting query panel which I build using the ‘All Queriable Attributes’ from the ‘Names Criteria’ section of the EmployeesView

Build Query Panel

Build Query Panel

looks like the picture below in the running application. As you can see JobId, ManagerId and DepartmentId are not part of the query panel but can be seen the result table.

Query Panel

Query Panel

In advanced mode you can’t add the missing attributes

Query Panel Advanced Mode

Query Panel Advanced Mode

You can remove the checkbox from the EO too, but this would mean that no VO build on this EO can query the attributes. If you only remove the checkbox in the VO you can build an other VO based on the same EO and make all attributes queriable.

You can download the sample workspace, build with JDev and depending on hte HR db schema, from here: BlogCascadingTable.zip
Please rename the file to ‘.zip’ after downloading it!


11 thoughts on “JDEV: af:query hide some attributes from query panel but show them in the result table

  1. Hi Timo,

    at first, nice post! But I have another option (ganz nach dem Motto “Viele Wege führen nach Rom”).

    For the ViewCriteria I define the “Search Region Mode” with “Basic” and “Show Operators” with “in Basic mode” (because this is one killing feature…). In the UI we set the “modeChangeVisible” to “false” for the af:query-component. Thats all. Now the User can change the operators but can not add new fields.

    The two screenshots to explain the better:

    best regards


  2. Hi Timo,

    Can u show me how to control the number of fields in the Advanced mode?

    Say i have 20 fields in my table and i created a view criteria with 2 fields. It would work perfectly in Basic mode. But in the Advanced mode all other fields selection is possible. I did not want to query with all 20 fields, just 10 fields of my choice is enough.

    Any ideas?


    • KR,
      isn’t this exactly what this post is about?
      Remove the ‘Queryable’ check mark from the attributes you don’t want to see in the advanced mode…


  3. Hi Timo,
    I had same requirement wherein i need to restirct the columns for addField dropdown in AdvancedSearch part. But whatever you had done in above by unchecking the Queryable checkbox will be at designtime….where as in my case the columns not to be shown in addfields will be decided at runtime from the application..so is there any way to do that…please help me out

    • Vishnu, the queryable attribute is part of the attribute definition. So I would try to to get the AttributeDef of the attriute and set the queryable attribute to false. I have not tested this but it’s worth a try.


  4. Hi Timo,

    As per your suggested approach by making attribute queryable false, our attribute is also removed from search criteria along with add fields list.
    I have a requirement in which I want to hide the attribute only in Add Fields list but I want to show that attribute in both basic and advanced search region.
    Please help me out.


  5. Timo,

    I did as your post suggested, but for some reason the query panel still displays all of the attributes of the table. Could there be something I am missing or was there a change in ADF 12c?

    • It might be a change in 12c. I have to look into this. However, this might take some time. If you can’t wait, ask the question on the OTN JDev&ADF forum.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.