RE: Lists of Names
Posted in 1996
By moving to INFORMIX (hope it is ESQL/C), I feel that U can
use the following method:
1. DECLARE name_cur SCROLL CURSOR FOR
SELECT name,<other flds>
FROM <tabname>
ORDER BY name.
2. After the user enters the first few characters of the name (into few_chars),
execute the following SELECT stmt. to find the position of that
record in the cursor.
SELECT count(*)
INTO $pos
FROM <tabname>
WHERE name < $few_chars
ORDER BY name.
3. FETCH ABSOLUTE $pos+1 name_cur
will give you the first record for the few characters entered.
4. From there, Use
FETCH NEXT name_cur
OR
FETCH PREVIOUS name_cur
to get the remaining records to be displayed on the scree or to allow
browsing.
Hope this helps U
-------------------------------------------------------------------------
Javeed Anwar T e-mail : javi@psi.ernet.in
PSI Data Systems Phone : (91 80) 5585726
19,Primrose Road
Bangalore 560025
INDIA
-------------------------------------------------------------------------
M. Livenspargar wrote:
:I'm curious: what are the best ways to handle lists of names in an
:Informix environment such that a user can enter a name and get a
:reasonable list of names from which to choose. In my current
:environment, which uses ISAM files, we have a large number of names,
:many of which are the same as others and are not in fact the same
:person.
:
:Currently, we allow the user to enter as much of the name as they
:choose to enter, then provide an onscreen alphabetical list such that
:the (partial) name entered would appear in the middle of the names on
:the screen. The user can scroll forward in the list or backward in the
:list, to the ends of the file if they so chose. To implement this, we
:have two files: one indexes the names in ascending alphabetical order,
:and the other indexes the names in descending alphabetical order.
:
:I would guess that we do not want to try to duplicate this exactly as
:we move to Informix. The "forward" select and the "backward" select
:might each select hundreds of thousands of records - since I'm
:currently in a development environment and don't have the database
:loaded with that many records and can't test it, I'm guessing that
:response time in an online program using that strategy would be
:unacceptable.
:
:I look forward to and appreciate your responses.
:
:Thanks,
:M. Livenspargar
: