Sorting and Indexing
Using indexes provides several benefits to your applications:
- They allow client datasets to locate data quickly.
- They let you apply ranges to limit the available records.
- They let your application set up relationships with other datasets such as lookup tables or master/detail forms.
- They specify the order in which records appear.
If a client dataset represents server data or uses an external provider, it inherits a default index and sort order based on the data it receives. The default index is called DEFAULT_ORDER. You can use this ordering, but you cannot change or delete the index.
In addition to the default index, the client dataset maintains a second index, called CHANGEINDEX, on the changed records stored in the change log (Delta property). CHANGEINDEX orders all records in the client dataset as they would appear if the changes specified in Delta were applied. CHANGEINDEX is based on the ordering inherited from DEFAULT_ORDER. As with DEFAULT_ORDER, you cannot change or delete the CHANGEINDEX index.
You can use other existing indexes, and you can create your own indexes. The following sections describe how to create and use indexes with client datasets:
Note: You may also want to review the material on indexes in table type datasets, which also applies to client datasets. This material is in Using Indexes to Search for Records and Limiting Records with Ranges.