Filtering results with standard query filters
Sometimes you want to use a query result object and filter the items in different ways when you iterate the result. For example, you have a query with complicated joins, predicates, and subselects. Several routines need to use the results of this complex query, but each routine processes different subsets of the results. In such cases, you can separate the query from the filtering of its results. You write query builder code in your main routine to construct and refine the query, and then produce a result object with the select method. Building the query once in your main routine improves the process of debugging and maintaining the query logic.
After you obtain a result object in your main routine, pass the result object to each subroutine. The subroutines apply their own, more restrictive predicates by using standard query filters. Also, the subroutines can apply their own ordering and grouping requirements. PolicyCenter combines the query predicates from the main routine and the standard query filter predicates from the subroutine to form the SQL query that it sends to the relational database.
In addition to using standard query filters in Gosu code, you can use standard query filters in the page configuration of your PolicyCenter application. List views support a special type of toolbar widget, a toolbar filter. A toolbar filter lets users choose from a drop-down menu of filters to apply to the set of data that a list view contains. Toolbar filters accept different kinds of filters, including standard query filters.
See also
