Subject RE: [IBO] first steps: query and cursor
Author Kaputnik
Boris, I think you might be doing something very complicated whereas a
pretty comfortable and flexible way exists already in IBO.

For displaying a different value (lookup) use an inline-select in your sql

-->(select lookupfield from loopkup-table where pk=fk) AS lookup-alias

and use TIB_Lookup-COmbo in combination with another TIB_Query with correct
Key-links and KeyDesc-Links and IBO will do the rest automatically and
highly optimized for you. Ne need to reinvent the weel with a combobox, when
TIB_LookupCombo can show you a complete look-up table with Grid, Incremental
Searching, configurable sorting and other goodies :-)

If you need help setting up your first lookup-table, the IBO-Help File
contains a pretty thorough section on how to set up lookups.
Basically, you generate a second query with only the fields from the
lookup-table you need (e.g. Order->Customer, you might want to select First
and last Name, City and Customer Number), add Lookup-Table.PK=Main-Table.FK
into the keylinks and Lookup-Table.Field=Main-Table.Inline-Alias into the
KeyDesc-Links and add the main table as keysource. Use the Wizard to create
ordering-links, and incremental searching is also enabled. Now, you only
need a TIB_Lookup-Combo pointing to lookup-table and everything is running


Nick Josipovic

CRM Administration
Prof. Dr. Franz Steffens
68163 Mannheim
Phone: ++49 621 181-1621
Fax: ++49 621 181-1618

> -----Original Message-----
> From: news@... [mailto:news@...]On Behalf Of Boris
> Schluszler
> Sent: Friday, November 30, 2001 11:19 PM
> To:
> Subject: [IBO] first steps: query and cursor
> Hello!
> For looking up city-names on zips I today coded this routine:
> with IB_Cursor1 do begin
> ParamByName('plz').AsString:=Edit1.Text;
> Open;
> while not Eof do begin
> ComboBox1.Items.Add(Fields[2].AsString);
> Next;
> end;
> Close;
> end;
> Did I get that correctly?
> I've got the feeling, this routine may still be optimized:
> Can I save the Open/Close-routines somehow?
> What is better to use: Query or Cursor?
> Should I Unprepare after using?
> Is preparation made automatically?
> Do I need preparation anyway?
> Regards, Boris