Confused about Master-Detail-Subdetail

Hello!

I have set up a datamodel that looks like this

0. CONTACTS (PK ID)
1. CONTACTS (masterlinked to 0 on FK BELONGS_TO_ID)
2. PROJECTS (masterlinked to 1 on FK MANAGED_BY_ID)
3. CHANGES (masterlinked to 1 on FK DONE_BY_ID)
4. PROJECTS (masterlinked to 0 on FK MANAGED_BY_ID)
5. CHANGES (masterlinked to 0 on FK DONE_BY_ID)

(PK means primary or unique key, FK means Foreign key or parameter link)

So, theese are my datasets (IBO TIB_Querys) and they are set up nicely and work fine. The TIB_Query's have a TIB_DataSource each. There is a TfrDBDataSet connected to each TIB_DataSource. The TfrDBDataSet with TIB_DataSource labeled 0 above is the Dataset property of the TfrReport itself.

So then I create a report with some bands:
Master Data has 0 as DataSource.
Detail Data has 4 as DataSource.
Detail Data has 5 as DataSource.
Detail Data has 1 as DataSource.
Subdetail Data has 2 as DataSource.
Subdetail Data has 3 as DataSource.

After fiddling with the "PrintIfSubsetEmpty" property it's stating to look as something usable. It works nice for records in 0 that do not have records in 1 (no record in 1 has the ID of 0 in its FK BELONGS_TO_ID).

BUT...

When a record in 0 has records in 1 then FR prints all records from 3 "belonging to" the first record in 1 between all bands with Datasource 4 and 5 generating a huge report.

Problem is that I cant find any way of telling FR about my data model. When a master is rolled up (FR navigates to a record in 0) then IBO will get the subsets of all datasets in "position". So apparently there are records in 1 and thus 2 and 3. Theese should of course not be printed before 4 and 5 are exhausted (finished repeating).

It seems FR is trying to print all bands regardless of their hierarcy in the data model. This can not be a working approach. FR needs to know not to start print Subdetails before it has printed the corresponding detail. But how can it know which detail the subdetail belongs under? I can not find any way of telling it.

Help me please!

Thanks a lot!

/Dany

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 12:19PM
    Hi Danny
    IMHO
    The first thing to understand is that the band description names have nothing to do with how the tables are initialy connected that is up to you.
    The bands are actually a place holder on a design page.
    Interpret master as data of level 1, detail as data of level2 sub detail of level3.
    The band through its associated frdbdataset controls the record positiong within the data supplied to it.
    mdb record1
    detail record1 belonging to mrec1
    sub detail record1 belonging to detail1
    sub detail record2 belonging to detail1
    sub detail recordn belonging to detail1
    detail record2 beloning to mrec1
    subdetail record1 belonging to detail record2
    and so on until all details and their subdetails are done
    mdb record2
    process repeats until all records of mdband are done
    When you use master/detail/subdetail that is the limit 3 levels to go beyond that
    you need to look at
    master detail detail detail or
    set detail to virtual 1 record and add a
    subreports and subreps within subreps
    hope this helps you understand it
    regards ;)
  • edited February 2004
    If I understand what you are trying to say that means that even though you can place several bands of the same type (Master, Detail, Subdetail respectively) on the same report page they represent a 3-leveled data model that can only comprise one dimension. My datamodels had two and three dimensions;
     ?  ? M
     ?  ? |
     ? -------------
     ? | ?  ?  ?  | ?  |
     ? D ?  ?  ? D2 ? D3 ?  (three dim)
     ? |
    -----
    | ?  |
    SD SD2 ?  ?  (two dim)
    
    i can only have
    
    M
    |
    D
    |
    SD
    

    Though if I skip the subdetail part I would be able to use more than one dimension for Details? Is this what you mean by Master detail detail detail?

    Thank you,

    Regards,

    /Dany
  • gordkgordk St.Catherines On. Canada.
    edited 12:19PM
    dany
    M level1
    det level2
    det level3
    |
    produces
    md1 mrecord1
    det1 all recs of det1 belonging to mr1
    det2 all recs of det2 belonging to mr1
    md1 mr2
    det1 all recs of det1 belonging to mr2
    det2 all recs of det2 belonging to mr2
    md1 mr3
    and so on

    now if you want subdetails from other table for detail1
    change detail1 datasource to virtual 1 rec and add a subreport to it
    in the subreport add a mdband to contain data you would have had in the detail1
    add a detailband to it to contain the data of the intermediate level
    this
    produces
    md1 mrecord1
    det1
    md2 of subrep1 mr1
    all recs of det belonging to mr1 of subrep1
    md2 of subrep1 mr2
    all recs of det belonging to mr2 of subrep1


    det2 all recs of det2 belonging to mr1
    md1 mr2
    det1 // which belong to mr2 of md1 on first page
    md2 of subrep1 mr1
    all recs of det belonging to mr1 of subrep1
    md2 of subrep1 mr2
    all recs of det belonging to mr2 of subrep1



    det2 all recs of det2 belonging to mr2
    md1 mr3
    and so on

    you can also nest subreps within subreps
    and have side by side subreps
    once you have figured out how to lay out the design pages it then becomes easy to figure out how to connect the datasets.
    hope this helps you out
    regards ;)
  • edited 12:19PM
    OK. Thanks for your patience Gordk. I'll take it from here and on.

    /Dany

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.