| INM V12 Database for Director
||Sorting and Indexes
||3.x Regular & Light
mOrderBy can only sort on one field. However it is possible to sort a selection on multiple fields by defining a compound index.
If you want your table to be sorted by F2 then by F3 and finally by F1, you would need to create your database with the following index:
F1 string 255
F2 string 255
F3 string 255
F231Index duplicate F2 ascending F3 ascending F1 ascending
This way, if you call mSetCriteria using F1, F2, F3 and then mSelect, the selection will be automatically sorted - you will not need to use mOrderBy!
Note that if your database contains another compound index on F2 and F3, and you call mSetCriteria with F2 and F3 only (not including F1), INM V12 Database will automatically call this [better suited] index. To force INM V12 Database to use F231Index, add a call to mSetCriteria with F1.
For more information about Indexes see: Optimizing your database with indexes.