Linking frxUserDataSets to Master Detail report
I'm trying to get a Master-Detail report to work using frxUserDataSets
I have a tiered TListView which I am trying to Print. In one frxUserDataSet I have the list of Groups from the TListView, this is linked to the MasterData in the report. Using the OnGetValue method of this DataSet gives me the correct number of Master Fields
In a second UserDataSet I want to show all the records under each group. I have tried to include Group in the Fields of the Person DataSet, but there is no way to link that to the Group Field in the Group DataSet. This results in each Group containing the full list of records in the Person DataSet
I have tried to filter the records in the OnGetValue method of the Person DataSet to return null if the groups do not match, but this just results in blank lines in the report where the groups are mismatched
Any Help?
I have a tiered TListView which I am trying to Print. In one frxUserDataSet I have the list of Groups from the TListView, this is linked to the MasterData in the report. Using the OnGetValue method of this DataSet gives me the correct number of Master Fields
In a second UserDataSet I want to show all the records under each group. I have tried to include Group in the Fields of the Person DataSet, but there is no way to link that to the Group Field in the Group DataSet. This results in each Group containing the full list of records in the Person DataSet
I have tried to filter the records in the OnGetValue method of the Person DataSet to return null if the groups do not match, but this just results in blank lines in the report where the groups are mismatched
Any Help?
Comments
instead of trying to filter
write code in the obp event of the band to control the visibility
or post a demo project here and i'll take a look
gordk
Thanks for the offer.
I've attached a trimmed down version of the reporting side of my application -
set report engine options doublepass to true and
add this code to your demo report
var
myvar:string;
idx:integer;
ar:tfrxarray;
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if engine.finalpass then
begin
masterdata1.visible := ar[<line#>] > 0;
end;
end;
procedure MasterData1OnAfterPrint(Sender: TfrxComponent);
begin
if not engine.finalpass then ar[<line#>] := detaildata1.dataset.recordcount;
end;
begin
ar := TfrxArray.Create;
end.