3 Replies Latest reply on Sep 29, 2010 3:45 PM by philmodjunk

    Two layouts on the same report - general direction?



      Two layouts on the same report - general direction?


      I have a table of parts. Some of the parts have subassemblies (in a related table).

      The user wants a printed report of parts three to a page, but if a part has sub-assemblies then that part should be printed on a page by itself and include the subassembly information.

      So say I have 5 parts without subassemblies, then 1 part with a subassembly, followed by 2 parts without subassemblies. The user wants the report to look like this--

      page 1 - parts 1, 2, and 3.

      page 2 - parts 4 and 5.

      page 3 - part 6 with its subassembly detail

      page 3 - parts 7 and 8.

      Somehow I need to fill a 3-up format with info, then release it for printing. Then do the same again. But if it encounters a part with subassemblies, release the 3-up page for printing no matter how much info I have accumulated, print the current record in one-up format, and release it for printing. Then return to the 3-up format.

      Is this making sense? Would appreciate comments on the approach. Thanks!

        • 1. Re: Two layouts on the same report - general direction?

          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:

          1. 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.
          2. 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.
          3. 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.
          4. 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.
          5. 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.
          6. 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.
          7. 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.

          • 2. Re: Two layouts on the same report - general direction?

            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.

            • 3. Re: Two layouts on the same report - general direction?

              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.