AnyDAC
ContentsIndexHome
PreviousUpNext
TADDataSet.SetRange Method

Sets the starting and ending values of a range, and applies it.

Group
Links
Parameters 
Description 
const AStartValues: array of const 
An open array of starting range values. 
const AEndValues: array of const 
An open array of ending range values. 
AStartExclusive: Boolean = False 
Exclude start range value. Default False. 
AEndExclusive: Boolean = False 
Exclude end range value. Default False. 

Use SetRange to specify the beginning and ending range values for the dataset and apply the range. 

AStartValues sets starting range the indexed field values. AEndValues sets ending range the indexed fields values. SetRange performs the following steps:

  • puts the dataset into dsSetKey state;
  • erases any previously specified starting range values and ending range values;
  • sets the start and end range values;
  • applies the range to the dataset.

If the current dataset record is within new range, then it will be current after a call to SetRange. Otherwise the current position will be set to the first record in the range. 

If either AStartValues or AEndValues has fewer elements than the number of fields in the current index, then the remaining entries are set to NULL.

procedure SetRange(const AStartValues: array of const; const AEndValues: array of const; AStartExclusive: Boolean = False; AEndExclusive: Boolean = False);
ADQuery1.IndexFieldNames := 'CUST_NO';
ADQuery1.SetRange([100], [200]);
What do you think about this topic? Send feedback!