Subject | Re: [IBO] How to synchronize 3 grids (N-M relation) ? |
---|---|
Author | pepmallorca |
Post date | 2002-02-23T10:49:44Z |
>You said to use the OnDataChange handlers of the two master
> There are a number of ways around this problem.
>
> You could attach code to the OnDataChange handlers of the two master
> datasources, or to the AfterScroll handlers of the two master
> datasets. Hello:
datasources, or the AfterScroll of the two master datasets (in my
case Queries).
I was thinking in this solution, sometime ago. But in my program
this has a problem. I have the most of the datasources, and querys
in a common datamodule. The detail is a query of one unique form
(because I don't want to reuse it), and in some forms I don't need to
refresh this 3rd query-grid.
I want a solution to refresh the 3rd query only in a form.
Maybe it's possibly redefine the AfterScroll dinamically when I go to
the form, and clear it when I exit from it, but I don't know how to
do it. How? and in which events?
Otherwise, I have found another solution. What do you think about
it? I have the 3 querys (2 masters) and 1 detais. I created 2
IB_EDIT associate to the 2 master querys (one field), and now I can
use the OnDataChange of the IB_Edit to do the next:
if not IB_QryC.Active then IB_QryC.active:=true;
IB_QryC.close;
// IB_QryC.Params.BeginUpdate;
IB_QryC.Params[0].AsString:=dm1.IB_QryA.FieldByname('A').AsString;
IB_QryC.Params[1].AsString:=dm1.IB_QryB.FieldByName('B').AsString;
// IB_QryC.Params.EndUpdate(true);
IB_QryC.Execute;
It works. It's good for you?
You said that I have to use the Params.BeginUpdate and
Params.EndUpdate with a try.... I don't understand the difference
between use it or not, and why I need a try?
Another question:
Do you think it's more optimal to use 2 parameters like in my
example, or to use a master-detail, and the other master simulate
like an unique parameter ?
Thank you,