First page Back Continue Last page Graphics


Notes:

Using the Query Component (continued)

When you drop an af:query component onto a JSF page, the component provides a search panel that includes one or more input fields for entering search criteria values. The user can select from the drop-down list of operators to create a SQL Query WHERE clause for the search. You can configure an input field to be a list of values (LOV), a number spinner, a date picker, or other control.

A Match All/Match Any radio group further modifies the query. A Match All selection is essentially an AND function. The query returns only rows that match all of the selected criteria. A Match Any selection is an OR function, where the query returns all rows that match any one of the criteria.

After users enter all the search criteria values (including null values) and select the Match All/Any option button, they can click the Search button to initiate the query. The query results can be displayed in any output component. Typically, the output component is a table or tree table, but you can associate other display components such as af:form, af:outputText, and graphics to display the results component.

If you enable the Basic/Advanced button, the user can toggle between the two modes. Each mode displays only the search criteria that were defined for that mode. You can define a search criteria field to appear only for basic, only for advanced, or for both modes.

In advanced mode, the control panel also includes an Add More button that exposes a pop-up list of searchable attributes. When the user selects any of these attributes, a dynamically generated search criteria input field and drop-down operator appears. All search criteria input fields are positioned in the order in which the attributes are defined in the data source. Any newly created search criteria fields will also follow this rule. For example, if the attributes in the underlying data source are ordered A, B, C, D, E, and the default search fields are A, C, and E. If the user adds D, the search fields appear in the order A, C, D, E.

This newly created search criteria field also has a delete icon next to it. The user can subsequently click this icon to delete the added field. The originally defined search criteria fields do not have a delete icon and, therefore, the user cannot delete them.

Note: Certain properties set on the view criteria in the ADF BC layer affect the run-time behavior of the query, such as the following:

Required property of view criteria row: Determines whether a view criteria item is a required or optional part of the attribute value comparison in the generated WHERE clause; default is optional, meaning that no exception is generated for null values. If set to required, an exception is thrown when no value is supplied; if set to Selectively Required, the view criteria item is ignored at run time if no value is supplied and another criteria item at the same level has a value; otherwise, an exception is thrown.

mode property of view criteria: Determines the initial mode, Basic or Advanced.