Subject Re: IB_LookupCombo + KeyLinks
Author Andrei Luis
Hi Helen, thanks for your ideas. But I feel it is like use a cannon
to kill a moskito!!!

I will remove reference on KeyLinks to price, and use something like
this on ibLookupCombo.OnExit =

qrSales.FieldByName('salePrice').asCurrency :=
qrProductLookup.FieldByName('listPrice').asCurrency

Thanks for your help,
Andrei

--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 11:11 AM 1/07/2005 -0300, you wrote:
> >Hello again,
> >
> >I don't know if it is possible do what I need 'automatic'...
> >
> >My scenario: Form of Sales
> >I need bring up the product list price and feed the sale price
when I
> >choose a product at a IB_LookupCombo.
> >
> >I got a clue from Helen another day that was use KeyLinks
properties like
> >that:
> > Sale_Price=qrSalesItems.Price
> > Product_ID=qrSalesItems.Product_ID
> >
> >OK, that solved the problem. For a while... However, sometimes I
need
> >to change this sale price, increasing or decreasing it. And there
is
> >my problem: when I do this, the LookupCombo clear its value. That's
> >obvious I know, but how can I do this work like I need?
>
> Not with TIB_LookupCombo, since it is designed to automate the
linking of a
> value - usually a key value - to a static lookup. So, if you need
to
> override the stored price, then TIB_LookupCombo is not the solution
on its
> own.
>
> You could add a calculated field to the dataset, e.g.
> PRICE_OVERRIDE NUMERIC(18,2)
>
> Calculated fields are, of course, not editable. Write OnCalcField
code to
> look for a value in an ordinary unbound edit box (labelled "Price
> Override"). If a value is there, apply it to the calculated field
and then
> clear the edit box. At BeforePost time, check the row for the
presence of
> a non-null 'PRICE_OVERRIDE' and, if found, apply that value to
the 'PRICE'
> instead of the regular value determined by the lookupcombo.
>
> That's only a suggestion. You might well come up with something
nicer.
>
> Helen