Saving queries for further use as datasources in new queries (Reusable queries)
The Professional version of Active Query Builder provides the unique ability to save end-user queries using them as views in subsequent queries.
The user can save a query as a Reusable Query in the WinForms and WPF versions via the special snippet in the lower right corner of the component. In the ASP.NET version, this snippet is located on the Queries tab below the Database Schema Tree. After that, he can start building a new query and then use the saved query in a new one. The Reusable Query will appear the same way as an ordinary database object in the component's UI and the SQL query text. Still, it will be substituted for the corresponding SQL text upon execution against the database server.
Reusable Queries are linked, not embedded, so the substitution is performed right before the execution. This means that if a Reusable Query itself is changed, the related query gets the latest SQL query text of Reusable Query. This way, the user can create multi-level nested queries and work with each query individually.
You can try this feature and get code samples using the Full-featured demo project in Professional and Trial versions. The QueryBuilder.PanesConfigurationOptions.UserQueriesPaneVisible property switches the Reusable Queries snippet on and off in the WinForms and WPF versions. In the ASP.NET version, a separate control should reside in your HTML layout to allow this feature.
To save Reusable Queries between work sessions, the programmer has to save the Reusable Queries repository using the QueryBuilder.ReusableQueries methods in the WinForms and WPF versions and the QueryBuilder.UserQueries methods in the ASP.NET version: ExportToXML and ImportFromXML (file or stream).
The well-proven mechanism of Virtual Objects enables the work of this feature. Reusable Queries are stored in the Metadata Container as objects of the new type MetadataType.UserQuery, so they can be accessed programmatically. Nothing stops the programmer from implementing a custom user interface to work with reusable queries instead of embedded snippets.