Subject Re: [IBO] Params ? not working, ? or master detail relationship. HELP PLEASE!
Author Helen Borrie
Hello Adrian,

At 07:00 PM 10/04/2004 +0200, you wrote:
>I upgraded to the latest release, and then did a build all.
>Previously this module was working just fine.
>Now it returns no records
>
>{Master}
>PraxData.IODIBOQuery.Active := True;
>{Childs datasource is set}
>PraxData.PPatientQuery.DataSource := PraxData.IODDataSource;
>PraxData.PPatientQuery.SQL.Clear;
>PraxData.PPatientQuery.SQL.Add('SELECT * FROM PATIENT WHERE
>PATIENTID=:IODPATID');
>PraxData.PPatientQuery.Open;
>PraxData.PPatientQuery.Active := True;
>
>Previously PPAtientQuery would be populated with data, now it isn't.
>
>I have changed none of my source code at all!
>Has it got something to do with the parameter.
>The PPatientQuery is in a DATAMODULE, and I'm using TIBOQuery's
>The original PPatientQuery definition doesn't have any parameters. It is
>just in this code portion that a parameter is required.
>

I see from another post that you want Jason to answer this himself. I
guess you will be waiting a few days for that, as Jason is very much
detached from work issues during Easter, because of his church commitments.

In the meantime, I can't offer a reason why your code worked in an older
IBO version and doesn't work now with IBO 4.3. My observation is that I
would not have expected it to work in *any* IBO version at all, because the
logic is wrong...so perhaps you are seeing a newer version of IBO that is
no longer tolerant to the logic error in your code.

For the master-detail logic to work properly for the code model you
provided, the attributes of the master-detail relationship need to be
established *before* either of the datasets is opened. The way you have
it, you open the dataset and *afterwards* try to set up the
detail-to-master relationship.

Could you set up a test using this sequence instead?

{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)

Another thought: how old is your old IBO version? Perhaps it is too old
to know about KeyLinks...

Helen