AnyDAC
ContentsIndexHome
PreviousUpNext
TADQuery.IndexesActive Property

Controls automatic maintenance of Index'es.

Group
Links

Use IndexesActive to indicate whether the dataset should maintain the data views, defined by the Indexes collection. 

When IndexesActive is False, the dataset does not maintain the data views. That avoids the overhead of updating views, while data is fetched or is edited. When IndexesActive is True (by default), the dataset maintains the data views. 

When indexes are maintained, each of them may be current index, selected by TADIndex.Selected or by IndexName properties. 

To selectively enable and disable data views rather than turning them all on or off at once, use the Active property of individual TADIndex objects. These objects are available through the Indexes property. 

If application needs to perform batch updates to dataset, then set IndexesActive to False before updates, and return to original value after updates. Also see BeginBatch / EndBatch methods.

property IndexesActive: Boolean;

Sorting Records, Indexes, BeginBatch, EndBatch

var
  lPrevIndsActive: Boolean;
...
lPrevIndsActive := ADQuery1.IndexesActive;
ADQuery1.IndexesActive := False;
try
  // perform updates here, without maintaining client views
finally
  ADQuery1.IndexesActive := lPrevIndsActive;
end;
What do you think about this topic? Send feedback!