Subject | Re: [IBO] IB_Query Ordering Problems |
---|---|
Author | Paul Vinkenoog |
Post date | 2003-05-12T11:36:34Z |
Hello Kenneth,
orderings, it's best to define them as OrderingItems at design time
(although you can also define them programmatically at runtime).
Multiple-column orderings are OK too. E.g. in one of my projects I
have OrderingItems:
Docent=4;4 DESC
Per.=PERIODE;PERIODE DESC
Aangemaakt=AANGEMAAKT;AANGEMAAKT DESC
Uitgezet=UITGEZET;UITGEZET DESC
OK=DOCENT_AKKOORD,PERIODE;DOCENT_AKKOORD DESC,PERIODE DESC
Notice that the last one orders on two columns. But more is also
possible. I often let the Query Editor autocreate the OrderingItems,
and then I finetune them: remove some, edit some (e.g. to add fields)
etc.
The corresponding OrderingLinks (for grid column ordering) are simply:
DOCENTNAAM=ITEM=1
PERIODE=ITEM=2
AANGEMAAKT=ITEM=3
UITGEZET=ITEM=4
DOCENT_AKKOORD=ITEM=5
Now, if the user clicks on the column header of the DOCENT_AKKOORD
column in the grid (the header caption is: OK), the query (and
therefore the grid) will be ordered on the TWO columns DOCENT_AKKOORD
and PERIODE.
Of course you can also change the ordering at runtime by assigning the
TIB_Query.OrderingItemNo
Greetings,
Paul Vinkenoog
> I have a simple query and want to sort this query at runtime. IIf you know beforehand that your program will use a limited number of
> assign the SQLOrder property on OnSQLPrepare event but it does not
> work.
>
> Here is what I have done:
> Query:
> select * from items
> for update;
>
> OnSQLPrepare event;
> if OrderByName then
> SQLOrder.Add('LOC_SHOP, NAME')
> else
> SQLOrder.Add('LOC_SHOP, ITEMCODE');
>
> I want to order the query based on LOC_SHOP and either NAME or
> ITEMCODE. When I run the program, I get INVALID TOKEN error.
>
> I tried to use SQLOrderingItems but it seems only work for sorting
> single column, may be I'm wrong. Please help!
orderings, it's best to define them as OrderingItems at design time
(although you can also define them programmatically at runtime).
Multiple-column orderings are OK too. E.g. in one of my projects I
have OrderingItems:
Docent=4;4 DESC
Per.=PERIODE;PERIODE DESC
Aangemaakt=AANGEMAAKT;AANGEMAAKT DESC
Uitgezet=UITGEZET;UITGEZET DESC
OK=DOCENT_AKKOORD,PERIODE;DOCENT_AKKOORD DESC,PERIODE DESC
Notice that the last one orders on two columns. But more is also
possible. I often let the Query Editor autocreate the OrderingItems,
and then I finetune them: remove some, edit some (e.g. to add fields)
etc.
The corresponding OrderingLinks (for grid column ordering) are simply:
DOCENTNAAM=ITEM=1
PERIODE=ITEM=2
AANGEMAAKT=ITEM=3
UITGEZET=ITEM=4
DOCENT_AKKOORD=ITEM=5
Now, if the user clicks on the column header of the DOCENT_AKKOORD
column in the grid (the header caption is: OK), the query (and
therefore the grid) will be ordered on the TWO columns DOCENT_AKKOORD
and PERIODE.
Of course you can also change the ordering at runtime by assigning the
TIB_Query.OrderingItemNo
Greetings,
Paul Vinkenoog