Subject | Re: [IBO] IB_Query Ordering Problems |
---|---|
Author | Paul Vinkenoog |
Post date | 2003-05-13T18:10:04Z |
Hi Kenneth,
only valid in an OnPrepareSQL handler). But it doesn't refresh
the dataset automatically. On an open dataset, do:
with qryItem do
begin
SQLOrder.Text := 'order by LOC_SHOP, ITEMCODE';
InvalidateSQL;
Refresh;
end;
the same procedure (but again: SQLWhereItems is only valid in
OnPrepareSQL), but you don't have to.
I still think however that if your query has a couple of fixed
orderings, the easiest way is to define them at design time
(using the Query Editor or by assigning OrderingItems via
the Object Inspector), and setting OrderingItemNo at runtime
to switch between orderings. I'm not near my development
computer now, but IIRC setting OrderingItemNo at runtime does
it all, i.e. you don't have to call InvalidateSQL and Refresh -
it's all done for you.
Greetings,
Paul Vinkenoog
> Hmmm.., I saw this before on other thread. Does it have toYou can use SQLOrder any place (unlike SQLWhereItems, which is
> use at OnPrepareSQL event? Or It can be used at any place and
> refresh the dataset automatically?
only valid in an OnPrepareSQL handler). But it doesn't refresh
the dataset automatically. On an open dataset, do:
with qryItem do
begin
SQLOrder.Text := 'order by LOC_SHOP, ITEMCODE';
InvalidateSQL;
Refresh;
end;
> In the GSG example, it also use SQLWhereItems beforeThey are different things. Of course you can set them both in
> SQLOrder. So it makes me wonders whether SQLOrder can only
> be used with SQLWhereItems. I am getting confuse.
the same procedure (but again: SQLWhereItems is only valid in
OnPrepareSQL), but you don't have to.
I still think however that if your query has a couple of fixed
orderings, the easiest way is to define them at design time
(using the Query Editor or by assigning OrderingItems via
the Object Inspector), and setting OrderingItemNo at runtime
to switch between orderings. I'm not near my development
computer now, but IIRC setting OrderingItemNo at runtime does
it all, i.e. you don't have to call InvalidateSQL and Refresh -
it's all done for you.
Greetings,
Paul Vinkenoog