I noted that TMDOTable does not load property the ixDescending option for a TIndexDef. The bugs are in unit MDOTable, at line 1586, in condition:
"if Query.Current.ByName('RDB$INDEX_TYPE').AsInteger = 2"
and should be:
"if Query.Current.ByName('RDB$INDEX_TYPE').AsInteger = 1"
The other bug id for applying the descending property in sql, in the same unit:
Procedure GenerateSQL
Starting at line 637
"else if IndexName <> '' then"
I had replaced the original line:
"OrderByStr := FormatFieldsList(IndexDefs[IndexDefs.Indexof (IndexName)].Fields);"
for:
begin
OrderByStr := FormatFieldsList(IndexDefs[IndexDefs.Indexof (IndexName)].Fields);
if ixDescending in IndexDefs[IndexDefs.Indexof (IndexName)].Options then
begin
StringReplace (OrderByStr, ',', ' DESC,', [rfReplaceAll]); {do not localize}
OrderByStr := OrderByStr + ' DESC'; {do not localize}
end;
p.d.: I used the code provided from IBTable unit.