inm logo
Corporate Website | Contact | Store | Support | Login  

View categorized listing of all common frequently asked questions.
View our categorized library of downloads for all necessary manuals, software, etc.
 Article Options
Support Center » Knowledgebase » INM V12 Database for Director » Sorting a selection on two or more fields
Support Page Banner
 Sorting a selection on two or more fields
INM V12 Database for Director Windows, Macintosh 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.

Article Details
Article ID: 96
Created On: 26 Sep 2006 01:53 PM

 This answer was helpful  This answer was not helpful

inm general footer
Services Xtras Go Products Support Gallery Store Download About Us Contact Newsroom