Reputation: 13
I have a Delphi 10.1 Berlin application that is using a kbmMemTable 7.82 table. It is indexed on two fields: lastname and firstname.
My problem is that the order is wrong when an apostrophe is encountered. It may also happen with other characters, but I haven't tested it extensively.
Does anyone have an idea what might be wrong? Any help would be appreciated.
I've tried it on both Delphi 7 and Delphi 10.1 Berlin and get the same results. I've tried having the index be case-sensitive and case-insensitive. In all four cases, I get the same results. I've also tried creating the index programmatically and through the object inspector.
Here is the generic form of how I created the index programatically:
Table.Open;
IndexDef := Table.IndexDefs.AddIndexDef;
IndexDef.Name := IndexByName;
IndexDef.Fields := 'lastname;firstname';
IndexDef.Options := [ixCaseInsensitive];
Table.Indexes.Add(IndexDef);
Table.IndexName := IndexByName;
Table.IndexFieldNames := 'lastname;firstname';
Table.CreateIndexes;
Table.EnableIndexes := True;
Table.First;
The index puts O'HARA after OLSON, instead of before. This works the same with and without case sensitivity.
Upvotes: 1
Views: 738
Reputation: 252
Its because the locale settings defines the order. Try to set mtifoIgnoreLocale in the index definition, alternatively setup a locale that provides the correct sort order.
Then it will do a simple sort.
best regards Kim/C4D
Upvotes: 1