Subject Re: [IBO] Master/detail don't work after set param manually
Author Helen Borrie
At 05:19 AM 21/06/2008, you wrote:
>Hi friends
>
>In one form X I have this mater/detail and work well
>
> dmComum.QdblookAluno.Close;
> dmComum.QdblookAluno.ParamByName('COD_ALUNO').Clear; //clear the param COD_ALUNO
> dmComum.QdblookAluno.DataSource:=dmsem.dsQmatriculaSem; //set the master datasource
> dmComum.QdblookAluno.Open;
>
>In other form Y I have and also work well
>
> dmComum.QdblookAluno.Close;
> dmComum.QdblookAluno.DataSource:=nil; //clear the master datasource
> dmComum.QdblookAluno.ParamByName('COD_ALUNO').AsString:=dmq.Qbusca.FieldByName('CODIGO').AsString; // set the same parameter manually
> dmComum.QdblookAluno.Open;
>
>but after to use the form Y e come back to for X, the mater/detail of form X don't work, it seem do not actualize the param COD_ALUNO
>
>this is a bug of IBO4.7.16?

That build of IBO is a beta version from January 2007!!! It undoubtedly has serious bugs, although your problem comes from wrong logic in your application workflow. The current release is 4.8.7.

> What could I do to solve the problem...

Fix the logic of your workflow.

1. In a master/detail relationship, the master dataset "drives" the detail dataset. (The detail dataset does not drive the master).

2. In an IBO application, the datasets govern what happens in the visual interface. So, if you set the dmComum.QdblookAluno.DataSource property in one place, then go to another part of your application and change it (or set it to Nil) then the original relationship is broken.

It *is* possible for a detail dataset to be used with 2 different master sets, but not simultaneously. If you need to swap the master datasource when the workflow jumps from one form to another then you must take care of the swapping before the user gets his eyes on the form.

Helen