Try OpenEdge Now
skip to main content
ABL Reference
Class Properties and Methods Reference : MaxDataGuess property

MaxDataGuess property

(Windows only; GUI for .NET only)
An estimate of the number of records that a query will return. The property's default value is zero.
Data type: INTEGER
Access: PUBLIC Readable/Writable
Applies to: Progress.Data.BindingSource class
The MaxDataGuess property offers a time-saving alternative for a ProBindingSource that binds to a query with a large result set. Some .NET controls must know the number of records in the result set when they initialize. By default, the ProBindingSource counts the records by reading the records in the query's result set, which can be time-consuming for large result sets. Setting this property provides the .NET control with an estimated value to bypass the counting process.
Because the .NET control used an estimated number when it visualized, you might see it readjust as the ProBindingSource's Count property develops a more accurate count of the records. For example, you might notice the vertical scrollbar thumb of a grid changing size to more accurately reflect the number of displayed records.
When using this property, remember the following:
*Set MaxDataGuess before opening the query.
*Set MaxDataGuess before setting the ProBindingSource's Handle property.
*The MaxDataGuess and Batching properties cannot both be TRUE at the same time. The ProBindingSource throws an exception if this happens.
*Do not open the query with the PRESELECT option. This is an exception to the normal rule with ProBindingSource queries. Since a PRESELECT query builds the entire result list, it negates the optimization from MaxDataGuess.
The following code snippet shows the correct order for using the MaxDataGuess property:
DEFINE VARIABLE rBindS AS Progress.Data.BindingSource NO-UNDO.
DEFINE VARIABLE hQuery AS HANDLE                      NO-UNDO.

  rBindS              = NEW Progress.Data.BindingSource()
  rBindS:MaxDataGuess = 200000.


rBindS:Handle = hQuery.

See also

Count property