Subject RE: [IBO] Params ? not working, ? or master detail relationship. HELP PLEASE!
Author Helen Borrie
At 11:49 AM 11/04/2004 +0200, you wrote:
>Well Helen
>
>I tried it as follows
>
>If Not PraxData.IODIBOQuery.Prepared then
> PraxData.IODIBOQuery.Prepare;
>
>//PraxData.PPatientQuery.Active := False;
>
>PraxData.PPatientQuery.SQL.Clear;
>PraxData.PPatientQuery.SQL.Add('SELECT * FROM PATIENT WHERE
>PATIENTID=:IODPATID');
>PraxData.PPatientQuery.DataSource := PraxData.IODDataSource;
>
>If Not PraxData.PPatientQuery.Prepared then
> PraxData.PPatientQuery.Prepare;
>
>PraxData.IODIBOQuery.Open;
>
>//PraxData.IODIBOQuery.Active := True;
>PraxData.PPatientQuery.Active := True;
>
>This results in the Master Query being populated, but only the first
>record in the child displaying, and when scrolling, no other records
>displayed.
>Note .. if I comment out PraxData.PPatientQuery.Active := True; , then
>the master Query is populated, and NO! records show in the child.
>
>Thanks
>Adrian

I can see how that would be. I found I had to call Open on both datasets,
viz.

{Set master query's SQL}
{assume that is done}

if not PraxData.IODIBOQuery.Prepared then
PraxData.IODIBOQuery.Prepare;

{Childs datasource is set}
PraxData.PPatientQuery.SQL.Clear;
PraxData.PPatientQuery.SQL.Add('SELECT * FROM PATIENT WHERE
PATIENTID=:IODPATID');
PraxData.PPatientQuery.DataSource := PraxData.IODDataSource;

if not PraxData.PPatientQuery.Prepared then
PraxData.PPatientQuery.Prepare;
(At this point, the Datasource linking should take care of populating the
'IOPATID' parameter; or throw an exception if it can't connect the two)

PraxData.IODIBOQuery.Open;
(Here, the master dataset should open the detail dataset; and then open
each new detail set as you scroll through the master)
-- But it doesn't, you have to open the first detail as well..
(my original supposition based on TIB_Query behaviour...means TIBO is
getting closer to TIB_ but not quite all the way)

PraxData.PPatientQuery.Open;

NB. would you please trim your messages?

Helen