MasterData+DetailData print DetailData only at last MasterData

I create complete report at runtime via ManualBuild.
I have 2 memory datasets with Master and Detail (XML attached).
Each item in MasterData can have any rows DetailData (simulated in this example test if MasterData contains any string).

In code I setup this:
lMasterDataSource:=IntForm.FindComponent('TabulkaDatasource') as TDatasource;
lDetailDataset.MasterSource:=lMasterDataSource;
lDetailDataset.MasterFields:='dbtKod';
lDetailDataset.IndexFieldNames:='Kod';

Datasets filled correctly,but DetailData printed only after MasterData band,Why?
Whats is bad?

I attached
MasterCDS.xml=data for master ClientDataset
DetailCDS.xml=data for detail ClientDataset
AfterGenerate.fr3=generated report
Doklad.pdf=Result report in PDF.

Comments

  • edited 8:54AM
    Hello,

    Do you need data to be like in the attached picture ?

    Regards,

    egroups wrote: »
    I create complete report at runtime via ManualBuild.
    I have 2 memory datasets with Master and Detail (XML attached).
    Each item in MasterData can have any rows DetailData (simulated in this example test if MasterData contains any string).

    In code I setup this:
    lMasterDataSource:=IntForm.FindComponent('TabulkaDatasource') as TDatasource;
    lDetailDataset.MasterSource:=lMasterDataSource;
    lDetailDataset.MasterFields:='dbtKod';
    lDetailDataset.IndexFieldNames:='Kod';
    

    Datasets filled correctly,but DetailData printed only after MasterData band,Why?
    Whats is bad?

    I attached
    MasterCDS.xml=data for master ClientDataset
    DetailCDS.xml=data for detail ClientDataset
    AfterGenerate.fr3=generated report
    Doklad.pdf=Result report in PDF.
    rpt.png 29.9K
  • edited December 2018
    Hello,
    Yes this I need.
    boakoms wrote: »
    Hello,

    Do you need data to be like in the attached picture ?

    Regards,

  • edited 8:54AM
    Hello,

    Then you need to place Footer after Master Data and select Print Footer After Each Row (or something like that ) in Master Data Options.

    Regards.

    egroups wrote: »
    Hello,
    Yes this I need.
  • edited 8:54AM
    I modified generator adding Footer for TabulkaMasterData but result stil print DetailData only last row TabulkaMasterData:(
    And TabulkaMasterData is unsorted but filled corectly (ordered by dbtKod).
  • edited 8:54AM
    Hello,

    I use attached structure to get result like in the picture.

    Regards.
    egroups wrote: »
    I modified generator adding Footer for TabulkaMasterData but result stil print DetailData only last row TabulkaMasterData:(
    And TabulkaMasterData is unsorted but filled corectly (ordered by dbtKod).
  • edited December 2018
    Thanks for tip.
    I removed footer for Master and added Subreport aka your example,but stil bad output.
    I simplified report,removed many items etc.
    Output contains DetailData,but every Detail on Every Master band:(
    I attached outputs.

    Any another idea?
  • edited 8:54AM
    Hello,

    You need to set TabulkaPolozkaReportDS Master Source propert to TabulkaReportDS. like you did before :

    lDetailDataset.MasterSource:=lMasterDataSource;

    Regards.
    egroups wrote: »
    Thanks for tip.
    I removed footer for Master and added Subreport aka your example,but stil bad output.
    I simplified report,removed many items etc.
    Output contains DetailData,but every Detail on Every Master band:(
    I attached outputs.

    Any another idea?
  • edited 8:54AM
    Bingo,
    many thanks for your help.
    But I have last problem.
    Why last detail after last Master line is doubled?
    boakoms wrote: »
    Hello,

    You need to set TabulkaPolozkaReportDS Master Source propert to TabulkaReportDS. like you did before :

    lDetailDataset.MasterSource:=lMasterDataSource;

    Regards.
  • edited 8:54AM
    Hello,

    could you attach fr3 file too.

    Regards.

    egroups wrote: »
    Bingo,
    many thanks for your help.
    But I have last problem.
    Why last detail after last Master line is doubled?
  • edited 8:54AM
    Sorry,this is fr3.
    boakoms wrote: »
    Hello,

    could you attach fr3 file too.

    Regards.
  • edited 8:54AM
    Hello,

    Make sure that subreport is in masterdata band.

    Regards.
    egroups wrote: »
    Sorry,this is fr3.

Leave a Comment