Subject AW: [IBO] Re: SearchingLinks Sample
Author Dr. Herbert Senner

possibly this might be a solution:

Define an OrderingItem for your ib_query:
OrderingItemSurname=Surname,FirstName<;Surname DESC,FirstName <DESC>>
(the sections in brackets are optional)
and perhaps another
OrderingItemFirstName=FirstName,Surname<;.> or whatever field you
want to include in your ordering clause.

Define an OrderingLink:
Surname<=ITEM>=n<;POS=x> where n is the OrderingItems' index
starting with 1 and x is an Integer for horizontal refinement
and perhaps the corresponding

Finally set OrderingNo to the OrderingItemIndex you want to be the active
index, where 0 means no ordering, 1 the ascending, -1 the descending
ordering of the first OrderingItem,
2 the ascending, -2 the descending ordering of the second and so on.

This will link an OrderingItem to a specific datafield and this datafield
does not even necessarily be included in your OrderingItem. You even can
include calculated fields in your OrderingItems

(f.e. I have a calculated field 'AGE_OF_PERSON' in one of my tables based on
an UDF; it is easily possible to sort on 'Surname,AGE_OF_PERSON' that way.
In older Firebird versions you have
to use field numbers instead of field names, but with Firebird 2.1 it is
possible to use the calculated fields names).

If according to your example you click on your datafield 'SURNAME' the
dataset will be ordered on 'Surname,FirstName' and if you have defined the
descending section, with a second click, it will be ordered according to
your descending section definition. If you now search on surname and your
surname is found, the result set is already ordered on first name.

There is one pitfall -I don't know, if Jason is aware of this and is an
intended behavior - with that solution: If your result set has more than one
rows with null values in the first column
of your (complex, this is not true for a monovalent) OrderingItem, there
will be shown just one row with a null value.

Herbert Senner

Von: [] Im Auftrag
von Francesco Castro
Gesendet: Dienstag, 12. Juli 2011 12:35
Betreff: [IBO] Re: SearchingLinks Sample

Hi, I have the same problem.
have you, solve it?


--- In <> ,
"Terry Black" <tblac@...> wrote:
> Hi I am using this example in an application Delphi7, Firebird database.
> After searching for the Surname I would then like to sort the results
based on First name, however, if I click on the header to sort on first name
it sorts the entire table on first name and ignores that I have already
searched on Surname.
> I want to use the Searchinglinks example search on surname but then sort
on First name.
> Terry

[Non-text portions of this message have been removed]