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
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)
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
This is as simple as I can make this structure to explain my problem.
These are my tables: -
Projects
PropertiesIndex: Project_ID
Project_by_PropertyIndex: Property_ID
UsersIndex: Project_ID + Property_ID
RightsIndex: User_ID
Project_by_UserIndex: Right_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.)Index: Project_ID + Right_ID + User_ID
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.Project_ID (for Users/Security)Projects._ID = Project_by_Property.Project_IDProject_by_Property.Property_ID :: Properties.Info
which whole section will repeat for the next project on a new page.Projects._ID = User_by_Project.Project_IDUser_by_Project.Right_ID = Rights.Right_ID:: Rights.Security_DetailsUser_by_Project.User_ID = Users.User_ID :: Users.Details
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
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.
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