ComponentOne True DataControl 8.0
Query Mode

The True DataControl Query Mode feature enables you to create powerful ad-hoc query forms in a matter of minutes. You can add Query By Example capabilities to your application with minimal effort, without manual coding.

The Query Mode feature resembles what is called Filter By Form in Microsoft Access, but is much more powerful and versatile. True DataControl query mode gives you complete design-time and programmatic control. You also have the choice of either using the same bound controls for query and result modes (simply toggle the QueryMode property to switch the modes), or using a separate True DataControl (or any other ADO data source, for that matter) to display query results. If you choose to display a query and its result in the same TData control, you can use the Query toggle button on the TData control to switch modes. The Query toggle button is enabled by the ButtonQuery property.

When a TData control is in query mode (the QueryMode property is set to True), the data in its recordset represents a query. The end-user enters query (search) values for fields in any of the bound controls. You can use the same controls, for example a grid, to represent a query and its results, thus implementing “Query By Example.” You can also create a form specifically customized for query mode. For example, create a form that provides combo boxes for selection, or allows end-users to enter an interval (“from” and “to” values) in a pair of bound controls. In the latter case you will probably choose to set QueryMode to True at design time so the TData control remains in query mode at all times, and use a separate TData control to display query results.

Setting QueryMode to False applies the query and switches the TData control from query to result mode. The same TData control’s recordset now contains the query result. Setting QueryMode back to True returns it to query mode, preserving the previously entered query.

The alternative to switching modes is to set QueryMode to True at design time, so the TData control will permanently remain in query mode. You can then use its QueryFilter property, assign its value to the Filter property of an ADO recordset. Presumably, you will use TrueData.Recordset.Filter property of another TData control, but you can use any other ADO recordsets as well. The QueryFilter property always contains the filter condition generated from the data entered by the end-user.

See Also

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback