Subject Re: [IBO] Ordering Items
Author Paul Vinkenoog
Hi Christian,

> I am using TIB_Query.OrderingItem to assign a default ordering item
> to my dataset. This works really fine.
>
> But is there a way to make it so that this ordering item is sorted
> in descending order?

You can define your OrderingItems like this:

Product=ProductField;ProductField desc
ArtNo=ArtNoField;ArtNoField desc
Date=DateField;DateField desc
etc.

Now if you assign OrderingItemNo = 1, the ordering will be on
ProductField; 2: on ArtNoField; and 3: on DateField.

But here's the trick: if you set OrderingItemNo to -1, -2, or -3,
the descending order will be used. More precisely: if you assign
a negative OrderingItemNo, the part after the semicolon will be
in effect.

If you want to make a certain ordering the default, put it in your
query's SQL:

SELECT ...
FROM ....
WHERE ...
ORDER BY DateField DESC

Now as long as you don't assign an OrderingItemNo (or if you set it
to 0), the dataset will be ordered on DateField DESC.


Greetings,
Paul Vinkenoog