Hmmm, that's definitely a challenge and if someone else comes up with a cleaner/simpler approach please post it!
My initial thought is to exploit a little feature of Save as PDF to generate a PDF of this report that combines output from several such "saves" into a single file. You can then open and print the PDF to get your report.
In rough outline, your script might work like this:
- Calculate a file name and store this name and file path to where you want it in a variable. You may want to use Get ( TemporaryPath ) to specify a location where this file won't stay forever.
- Switch to a layout where you specify a report header for your report. Use Save as PDF and the above variable to save this file as a PDF to get the PDF started.
- Perform a find on your "three up" report layout and sort the results as needed to set up a found set for your report. You may need to save the criteria for this report in global variables as you will perform this same find repeatedly during the script steps below.
- Loop through your records and exit the loop on the first record that has a sub asembly detail. Save your current record number in a variable.
- Use Omit Multiple to omit all records from this sub assembly record to the end of the found set. Use Save as PDF to Save this part of your report to the FilePath variable's location, using the "append to existing PDF" option to append it to the first section already saved to this PDF.
- Repeat the original find and use your record number you saved in a variable to omit the records you just save into the PDF. Use Go To Related Records to pull up your sub assembly part on the sub assembly detail layout and save it as PDF, using the "append to existing PDF" option to append it to the sections of the report already saved to this PDF.
- Return to the 3 up layout, omit the current record (your sub assembly record) and repeat the loop/omit/Go To Related record process to generate the remainder of your report.
Admittedly, this is complex and "messy", but I think you can get it to work if you pay careful attention to detail and thouroughly test the results. Once you've created your report, there are ways to open the PDF automatically so that the user can view and print the resulting report.
Thanks for the detailed approach. Helped me persuade the user that this report was perhaps more complex than need be and definitely beyond my capabilities (grin). Will keep this around and for future reference.
The main issue is the number of records per page. Another option is to list the subassembly records listed in a large portal set to slide up/resize enclosing part. Sliding portals have their limitations, but you may want to experiment with that option.