Subject Re: [IBO] Looping through OrderingItemsNo: how?
Author Lucas Franzen
"Marco Menardi " schrieb:
>
> IBO 4.2lb, native IB_ components.
> Hi, I want to create a procedure that tests all my queries to see if
> I've some mistake in them before my customer will do ;)
> So I loop through all my datamodule and prepare the query. I would
> like also to try all the OrderingItemsNo allowed, but I don't know how
> to loop in them, since OrderingItemsNo can be negative...
> How can I test all the OrderingItemsNo a query allows?

Marco,


for ii := 1 to qry.OrderingItems.Count - 1
will give you all the entries for ASCENDING orderings.

Since the OrderingItems look like:
<USER_FRIENDLY_NAME>=FIELDNAME(s)[;Optional DESCENDING]
you have to parse the FIELDNAME

or try it the following way:

for ii := 1 to qry.OrderingItems.Count - 1 do
begin
try
qry.OrderingItem := ii;
except
ShowMessage ( 'Wrong ordering. qry: ' + qry.name +
' Index: ' + IntToStr ( ii ) );
end
end

If you can orderting ascending (positive) you should be able to order
descending, too....

HTH
Luc.