Subject Re: [IBO] adding a calculated field to a DBGrid
Author Helen Borrie
At 06:43 AM 15-10-02 +0000, you wrote:
>are you really trying to use TIB_Query with TDatasource and TDBGrid

I am using TIBOQuery.

At 08:01 PM 14-10-02 +0000, you wrote:
>I use IBO3 with Delphi 3.
>
>I want to display item IDs and item descriptions in a DBGrid.
>
>This is easily done by constructing a TIB_Query (should be TIBOQuery) with
>the following SQL string:
>
>'select cod_art, des_art from art order by des_art'
>
>A Datasource links the TIB_Query to a DBGrid and voila', ev works.
>
>Now the problem.
>
>I want to display the existing quantity QTY for every item, aside ID
>and description.
>
>But QTY is not a table field.
>
>QTY can only be dinamically calculated by a SP (whose name is Q_E)
>that accepts an item ID and the final date for the calculation.
>
>This beats me.
>
>How can I do that ?

Where do the input values for the stored procedures come from? Some
correlation would need to exist between the main record and the input to
the SP in order to be able to represent the calculated value as a member of
the dataset.

For a set like this, I think the most elegant way would be to define the
entire set as a selectable stored procedure, thus making sure that every
row arrives at the client with its correct QTY value... or, with
correlating keys, you may be able to acquire the set using a correlated
sub-query or a join.

Helen