ComponentOne True DataControl 8.0
Using Multiple Query Fields for a Single Result Field

A common task in creating ad-hoc query forms is to allow the user to specify an interval of field values. True DataControl provides this ability as a particular case of the following general rule:

You can create several data fields connected to the same SourceRecordset field, by setting the DataSourceField property to the name of a SourceRecordset field, for each of them.

At design time, for each such field, create a new field in the Fields property page, select the Data radio button, give the field a Name, and select the desired data source field (the same for each newly created field) from the DataSourceField combo box.

You can specify two TData control fields connected to the same SourceRecordset field: set QueryOperation to ">=" for one of them, and to "<=" for the other.

By binding two controls to these two fields, you enable your user to enter an interval of field values in the query.

Normally, such fields are invisible in result mode, QueryMode = 1 – Query only, but that is up to you, of course.

Example:

If you want to allow end users to specify a range of dates for the OrderDate field, you can do so by creating two new data fields: OrderDateFrom and OrderDateTo, setting the DataSourceField property to OrderDate for both of them. For the OrderDateFrom, field specify QueryOperation = >=, and for OrderDateTo you setQueryOperation = <=. You make them visible only in query mode (QueryMode = 1 – Query only). The original OrderDate field remains in your TData control too, because you want the OrderDate to appear in the result recordset.

 

 


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

Product Support Forum  |  Documentation Feedback