Placing multiple subreports on a page
I need to design a work order which is a single page for each selected record from an Orders table. Each order also has multiple detail records from up to 6 related tables, for which I will use subreports. I am having a bit of a problem placing the subreports on the page in the way that the client wants them. The layout is difficult to explain so I have created a drawing of it which you can see by clicking the link below.
I plan to create a master band for the top section (Design, Posting, Pressing and Grinding areas) and a child band for the bottom (Finishing and Shipping areas), each containing the appropriate subreport. My problem is with the Pressing and Grinding sections since these are alongside the Design and Posting sections, but underneath each other. Since two subreports can't be placed under each other in the same band like this I am wondering how to achieve this layout.
Glenn
Click here to see layout
I plan to create a master band for the top section (Design, Posting, Pressing and Grinding areas) and a child band for the bottom (Finishing and Shipping areas), each containing the appropriate subreport. My problem is with the Pressing and Grinding sections since these are alongside the Design and Posting sections, but underneath each other. Since two subreports can't be placed under each other in the same band like this I am wondering how to achieve this layout.
Glenn
Click here to see layout
Comments
in mamy cases I have found that when sample data is supplied i usually find something that was overlooked.
Also will framelines be needed or are just using them to show the areas?
is there a limit to the number of records in each detail table per order table record or could any of the whole layout force a second output page to be produced?
There is a possibility that this may be as simple as a couple of child bands stretched and alow split using memoviews with code in their obp event to iterate through the records of each detail table dataset and use the memo.lines.add method to add the text we want to each memo.
In retrieiving the data, I will be using queries, not tables. I will run a query to get all the necessary orders and in the OnScroll event of this query I will run 6 queries to get the detail records. I have tried this with some other data on a simple layout and it works fine. I actually did think about creating a bunch of calculated memo fields in the query to hold each set of detail data, similar to what you are saying but done at the database level rather than in the report. In that case the 6 queries would possibly be run in the OnCalcFields event rathen than OnScroll. Of course the iteration to create the memo fields would have to be in OnCalcFields. Actually this method would completely eliminate the need for subreports. In each place on the layout where I have indicated a subreport I would simply place one of these memo fields. What do you think of this idea?
BTW the right hand side the 2 subreports you show could possibly be 1 subreport using 2 masterbands and 2 headers.
you can also use engine object to set and control curx cury props for bands and objects.
generally i usually use frames of memos for horizontal lines and some the shapeview for diagonal lines and shapes. when the output page is always the same like a preprinted form i usually use and overlay band to handle lines adding the overlay to the design page last and below the last band and large height in design mode from page settings. I also usually design in pixels
memo 3 located in master band below other memos has a fixed height and we wanted detail data from tclientdataset connected to master tclientdataset in this memo.
placed a non visible detailband on design page connected to detaildataset for for access to props and navigation.
procedure Memo3OnBeforePrint(Sender: TfrxComponent);
var i: integer;
begin
memo3.lines.clear;// clear design note text then insert
for i := 0 to detaildata1.dataset.recordcount -1 do
begin
memo3.memo.Insert(i,<ISP.Phases."Phase">);
detaildata1.dataset.next;
end;
end;
I'm not sure yet if I'll use the memo method or the subreports with your suggestion of combining the two on the upper right into one with two master bands. What would be your preference?
Also, if I do use memos, I'll create them in the OnCalcFields as I mentioned before, rather than in the report. I prefer to do as much coding as possible in the app itself rather than in the report.
IMHO i prefer to do all coding in a report , since this means that if a report needs to be modified I don't need to make changes in the app itself and have to recompile and re distribute to clients.
When designing layouts that seem to be difficult, i do as you have
make a sketch of the layout decide which bands & objects to use.
add bands to design page with 1 memo in each with some meaningful static text & back color.
add data bands in the same fashion but do not connect to data source/set , set the record count property of the band to the num of records you think the dataset will return .
save and preview to check the output, you can now play with record counts etc to see what happens in the output.
FWIW i would move to fr4 as that is where further development/improvements is happening.
Also look in the news groups there are many examples and demos in the binaries.
I appreciate your help and will get back to you on this if necessary. Right now I'm just scoping out what's involved in this app but it may be a while before I"m actually doing any coding.