Subject Re: [IBO] Lock Conflict Problem
Author Helen Borrie
At 11:04 AM 23/06/2005 +0300, you wrote:


> > No. If you work out the data you actually want, I'll try to help with the
>
> > syntax; but what you are asking here isn't logical without some
> > correlation between tableA and tableB. Also, as I understood, it wasn't
> > sums you wanted to represent, but averages....
> >
> > >if not can you give me an example ?
> >
> > Certainly, given a practicable problem description.
> >
>
>o.k. here is my example. I have a stocks table Table A( stock_code,
>stock_name,....)
>and I have another table which keeps the prices, amounts coming in and going
>out Table B (amount, price, in-out,...)
>
>I want to show in a grid => Stock Code , Stock Name, average cost price,
>average selling price..

Create a view...

>Sorry I mean TIB_query component. I used two TIB_query components with two
>grids to solve this problem. One is showing the stocks card details and the
>other is showing averages and totals. But this happens in TWO grids. I want
>to show them in one grid.

One grid displays one dataset. What you should be thinking about is a way
to show the single-row aggregate (in this case two averages) for the rows
in the dataset - that is, two sets. TIB_Grid cannot display rows from two
different sets.

Why not implement this as master-detail? Create a view for the aggregates,
grouping by the key column(s). This is your master set. MasterParamLink
the stock details to the key columns of the view.

If you want the grid to appear as if you have details above and the
aggregate in the "bottom line", just set up IB_Edits for the aggregate set
beneath each grid column and set their size to match the FieldsDisplayWidth
of the corresponding grid column. If you have a requirement to allow the
user to resize the grid, you can write event handlers to keep the sizes of
the IB_Edits in sync with the FieldsDisplayWidths at runtime.

Helen