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.
Here we remove the check mark from the ‘Queryable’ checkbox like I did for the JobId attribute in the picture below
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
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.
In advanced mode you can’t add the missing attributes
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 11.1.2.1.0 and depending on hte HR db schema, from here: BlogCascadingTable.zip
Please rename the file to ‘.zip’ after downloading it!
Hi.
Nice post.
I think this article could be good for this topic, it deals about show / hide controls of the af:Query
http://www.notjustjava.com/2011/12/cool-tips-to-showhide-components-of-the-query-control-of-adf/
Juan,
Thanks for pointing this (your) blog out. Did not know your blog about this issue. Keep posting…
Timo
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
Martin
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
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…
Timo
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.
Timo
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.
Thanks
Nitesh
Hi Timo,
I have the same problem as faced by Nitesh. Any inputs from you to fix this??
Please help.
Thanks
Czar
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.