Pages or SubReports

Hey people, loving FastReports, but I've come unstuck on the best approach to my problem.

This is as simple as I can make this structure to explain my problem.

These are my tables: -
Projects
Index: Project_ID
Properties
Index: Property_ID
Project_by_Property
Index: Project_ID + Property_ID
Users
Index: User_ID
Rights
Index: Right_ID
Project_by_User
Index: Project_ID + Right_ID + User_ID
(Project_by_User has a primary key of Project_ID + User_ID but I am using this index to sort the users by the rights they have.)


The Projects table is the master - I start a new page on each project, no problems with that!

For each project there can be multiple properties, standard master/detail. Projects -> Project_by_Property -> Properties.
(Project_by_Property is really "many to many" but as I am handling 1 project at a time, it's effectively "one to many".)

After that prints though, within the same project, I now want to print the Users who have access to that project, and each user has a set of security rights. Some users can have the same level of security so I want to group those users together, then under them show the rights they have.

I would think this requires either multiple pages or subreports - it physically won't fit on one page anyway.


The Tables.Fields would look something like this: -

Projects.Project_ID (for Properties)
Projects._ID = Project_by_Property.Project_ID
Project_by_Property.Property_ID :: Properties.Info
Projects.Project_ID (for Users/Security)
Projects._ID = User_by_Project.Project_ID
User_by_Project.Right_ID = Rights.Right_ID
User_by_Project.User_ID = Users.User_ID :: Users.Details
:: Rights.Security_Details
which whole section will repeat for the next project on a new page.


How can I lay this out, Bands Master and Detail, Pages / Sub-reports?
What bands would I need with what DataSets?
And if I use multiple pages, what should their Page.DataSet be set to?

Thanks in advance!

Cheers
Jonathan

Comments

  • edited 11:51AM
    My simple answer, use query components (one or more) to extract the data.
    Using queries the indexes are totally irrelevant except for speed to extract the resultant datasets.
    You can also sort any result by any one or more columns.
  • edited December 2012
    Thanks for your reply [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> In an effort to explain my problem simply it seems I made it sound too trivial. Sourcing the data and the control of the master/detail/detail tables was not an issue (it already works cleanly on my Delphi forms); it was how to duplicate that in Fast Reports. I'll post my solution in case someone else comes across this with a similar issue. I used subreports as opposed to distinct separate pages. Separate pages would print all the properties of all the projects, then print all the users/security of all the projects (like they were 2 separate reports); subreports prints the properties then the users of one project, then moves onto the next. My[/img]Page1 (DataSet not assigned) has these bands: -
    PageHeader: Shows the Project ID and Project Name and page number etc.
    MasterData: DataSet := Projects; shows some extra project info (also has StartNewPage)
    MasterData.Child1: Has the Properties Subreport (also has Stretched set)
    MasterData.Child2: Has the UsersRights Subreport (also has Stretched set)
    MasterData.Child3: Just has a double line through it indicating end of Project

    Multiple children were needed to prevent the subreports overlapping.


    Properties Subreport (Dataset not assigned) has these bands: -
    Header: Just some column heading for the information
    MasterData: DataSet := Properties; Shows the project's properties information


    UsersRights Subreport (Dataset not assigned) has these bands: -
    Header: Just some column headings for the information
    GroupHeader: Condition := Project_by_User.Right_ID (to group users by their rights)
    also shows the Rights ID and Rights Description texts to indicate the start of this group (also has KeepTogether set for clarity)
    MasterData: DataSet := Project_by_User; shows the User ID and User Name
    GroupFooter: Again shows the Rights ID and Rights Description but also the full rights matrix for those users listed in the group



    This is my working solution, doctored for brevity. If this could of been solved more easily then please say!

    Cheers
    Jonathan

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.