Subject | Re: [IBO] ParamByName |
---|---|
Author | Helen Borrie |
Post date | 2001-07-03T13:08:26Z |
At 12:33 PM 03-07-01 +0000, you wrote:
e.g. parentdataset.SQL:
select a_pk, column1, column3, lookupkey
from atable
where.....
parentdataset has an ib_datasource named ds_parentdataset.
lookupdataset.SQL:
select b_pk, description from btable
On the lookupdataset:
KeySource: ds_parentdataset
Keylinks: b_pk=atable.lookupkey
If you want to show the selected description in the parentdataset's control(s) you add one more column to it:
select a_pk, column1, column3, lookupkey,
(select description from btable where b_pk=lookupkey) as MyDescription
from atable
where.....
Then, in the lookupdataset, set the KeyDescLinks property:
DESCRIPTION=ATABLE.MYDESCRIPTION
In the parentdataset, flag MYDESCRIPTION as a COMPUTED column.
If the parentdataset is displaying in a grid, make the lookupkey column's VISIBLE attribute False and display MyDescription in its place. (If you are using ib_edits, just don't include one for that column). IBO will take care of all the parameters for you AND refresh MyDescription once the row is posted (or instantaneously if the lookupcombo isn't embedded in the grid).
Hope you can follow this - if not, just give another shout.
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>I am using TIB_LookupDialog, TIB_Query, and TIB_Datasource. Thank you forI'm not clear what you mean by this...if the relationship is properly set up to hook the lookup dataset up to the linked column in the parent dataset, you don't have to do any code to make this work. You certainly won't need to be doing anything with a generator to make it happen. You won't need to call ParamByName() either - IBO takes care of the parameters for you.
>any help you can give. I am brand new (only 4 months) to programming and
>Delphi and Interbase.
>I need to know how to use ParamByName so that when my lookup dialog
>is executed and the user clicks on a record, I can use the FileKey
>field I have created with a generator to match the record and be able
>to use it to make sure all changes are made to the selected record.
e.g. parentdataset.SQL:
select a_pk, column1, column3, lookupkey
from atable
where.....
parentdataset has an ib_datasource named ds_parentdataset.
lookupdataset.SQL:
select b_pk, description from btable
On the lookupdataset:
KeySource: ds_parentdataset
Keylinks: b_pk=atable.lookupkey
If you want to show the selected description in the parentdataset's control(s) you add one more column to it:
select a_pk, column1, column3, lookupkey,
(select description from btable where b_pk=lookupkey) as MyDescription
from atable
where.....
Then, in the lookupdataset, set the KeyDescLinks property:
DESCRIPTION=ATABLE.MYDESCRIPTION
In the parentdataset, flag MYDESCRIPTION as a COMPUTED column.
If the parentdataset is displaying in a grid, make the lookupkey column's VISIBLE attribute False and display MyDescription in its place. (If you are using ib_edits, just don't include one for that column). IBO will take care of all the parameters for you AND refresh MyDescription once the row is posted (or instantaneously if the lookupcombo isn't embedded in the grid).
Hope you can follow this - if not, just give another shout.
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________