Applying or Canceling a Range

From RAD Studio
Jump to: navigation, search

Go Up to Limiting Records with Ranges


When you call SetRangeStart or EditRangeStart to specify the start of a range, or SetRangeEnd or EditRangeEnd to specify the end of a range, the dataset enters the dsSetKey state. It stays in that state until you apply or cancel the range.

Applying a range

When you specify a range, the boundary conditions you define are not put into effect until you apply the range. To make a range take effect, call the ApplyRange method, that immediately restricts a user's view of and access to data in the specified subset of the dataset.

Canceling a range

The CancelRange method ends application of a range and restores access to the full dataset. Even though canceling a range restores access to all records in the dataset, the boundary conditions for that range are still available so that you can reapply the range at a later time. Range boundaries are preserved until you provide new range boundaries or modify the existing boundaries. For example, the following code is valid:

Delphi:

MyTable.CancelRange;
// …
// Later on, use the same range again. No need to call SetRangeStart, etc.
MyTable.ApplyRange;

C++:

MyTable->CancelRange();
// …
// Later on, use the same range again. No need to call SetRangeStart, etc.
MyTable->ApplyRange();

See Also