Subject Re: [IBO] incremental search on multiple column sort
Author Helen Borrie
At 09:35 PM 4/12/2004 +0000, you wrote:


>Delphi D7
>IB_LookupList populated by an IB_Query
>
>I am unable to search properly when I sort on multiple columns...
>
>The SQL is:
>
>SELECT ITEMNUM
> , ITEMNAME
> , PRICE
> , NON_SEED_ITEM
>FROM ITEMS
>
>The Ordering Items information is:
>
>ITEMNAME=NON_SEED_ITEM,ITEMNAME
>
>The Ordering Links is:
>
>ITEMNAME=ITEM=1
>
>My result rows are something like this:
>
>123 Basil 0
>456 Tomato 0
>789 Watermelon 0
>012 Pallet 1
>013 Bag 1
>
>This puts all the "Non-Seed" items at the bottom of the list.
>
>When I do an incremental search in the Listbox, it works fine for
>all items with a "NON_SEED_ITEM" = 0, but I get nothing on the items
>for "NON_SEED_ITEM" = 1.
>
>Is there any way to tell the search to ONLY look in ITEMNAME field?

Make the ITEMNAME the first element in the ORDER BY criterion. But then
you lose the ordering you wanted: to have the items in "seed" order.

What you really want (I think!!) is to provide a reversible search order,
so that you can flip the search to look for the higher-numbered "seed" flag
first. That's very easy in this case, where you have only two possible
values:

OrderingItems:

ITEMNAME=NON_SEED_ITEM,ITEMNAME;NON_SEED_ITEM,ITEMNAME DESC

Now, when you click the ordering button on the column, the order will
toggle to having the "1" items first.

If you want the descending order to be the default order, set Ordering
Links to :

ITEMNAME=ITEM=-1

But note, also, if you want to enable a run-time ordering by ItemName alone
(and disregard its Seed setting), just add another OrderingItem to the
array (the property is a stringlist):

NAMEONLY=ITEMNAME;ITEMNAME DESC

and OrderingLinks to:
NAMEONLY=ITEM=2 (or -2, if you want the default to be descending).

Helen