Master - detail problem
I'm having problems setting up a master-detail report. What I have is:
IBXQuery1: the masterdata
IBXQuery2: the detaildata, containing the parameter :IDParam
Both of the queries have a ID-field, containing matching information.
IBXQuery2.Master=IBXQuery1
In the IBXQuery2.params I've set up Name=IDParam, DataType=Integer, Value=<IBXQuery1."ID">
On my report page I have 2 bands:
- a TfrxMasterData band where dataset=IBXQuery1
- a TfrxDetailData band where dataset=IBXQuery2
When running the report I can't get the detaildata to follow the materdata in the output. The detail is returning only data from the first master.
What am I missing here?
Petter
IBXQuery1: the masterdata
IBXQuery2: the detaildata, containing the parameter :IDParam
Both of the queries have a ID-field, containing matching information.
IBXQuery2.Master=IBXQuery1
In the IBXQuery2.params I've set up Name=IDParam, DataType=Integer, Value=<IBXQuery1."ID">
On my report page I have 2 bands:
- a TfrxMasterData band where dataset=IBXQuery1
- a TfrxDetailData band where dataset=IBXQuery2
When running the report I can't get the detaildata to follow the materdata in the output. The detail is returning only data from the first master.
What am I missing here?
Petter
Comments
select * from detail_table where id = :id
Thanks.
My detail SQL looks basicly just like this...
So I tried the OBP-event of Masterdata band (IBXQuery1):
IBXQuery2.Close;
IBXQuery2.Open;
(also tried to add IBXQuery2.First)
What then happens is that the report ends when it was supposed to print the second master's details. And the rest of the masterdata is not printed...
Thanks again.
Now it's working. The OBP-event open/close code actually solved my problem, without the need of resetting parameters there.
The reason why the report ended after the second masterdata-print, was that this masterdata record had no details. So I checked the Masterdata.PrintIfDetailEmpty, and now it works like expected.
Maybe is it a bug that causes the report to end instead of forwarding to next record in masterdata when Masterdata.PrintIfDetailEmpty=false?