It is a common problem and one that those training materials should show you how to handle.
Print your invoice or purchase order from a layout based on the line items table. Make this a list view layout and you can include fields from the Order record in the header, footer or grand summary parts of that layout. The final part of this process once you have a layout to use for it, is to set up a script that pulls up the correct group of order line items for the current record on your Orders layout (the one with the portal). Go To Related Records can be used for that purpose.
It seems to me this must be a common problem and has been encountered and solved already.
Indeed. The solution is simple: create a second layout that is based not on the Order/Invoices table, but the line items table, and that uses List view, instead of the Form view you'll probably use on the Invoice layout with the portal.
In this new layout your portal rows are records in their own right and can be listed, taking (just) as many pages as necessary. Use headers/footers to display data from the related parent record (invoice data, customer data), and summary parts to total or otherwise summarise the line items.
Of course, the entire process of finding an invoice's related line items and sorting/displaying/printing them can be scripted.
Thank-you. I assume there must be something in the script that dictates the correct number of order line items for the available space on the first page, second page and so on until all the order items are added to the order?
Sent from my iPhone
I assume there must be something in the script that dictates the correct number of order line items for the available space on the first page, second page and so on until all the order items are added to the order?
No, its not really the script, but the setup of the layout.
Usually you have footer, header, maybe a sub-summary part and/or a grand summary. Now divide the space that is left on the page (as per the page setup) by the height of the body part - the result ist the number of records that fit on a page. Divide the number of line items by that result, and you know the final page count.
Note that this description is a bit simplistic, since you couldn't say exactly how much space is occupied by a sub-summary part (that appears for every sorted group), or what impact different headers for 1st page / remaining pages will have - but it's the general principle.
A script then could, for example ...
- take you to (only) the related records, using the print layout, or
- exit the script if there are no related records
- sort the records (which is obligatory if you have sub-summary parts to display)
- offer to print the script - or not - then (either way)
- return you to the original layout
This can be as basic as you want, or as sophisticated as you need.
I see in Layout Part setup I can set a number of occurrences before starting a new page. After performing the calculation you described above, do I end up with the # of occurrences that I would plug into the Part Set-up dialogue box?
Most of the time, you don't need to do any calculations and don't have to change that setting. The system will automatically fit as many lineitems as it can on a page, printing multiple pages if needed. Make sure that you use List View for this layout and size the body to be a small narrow row just tall enough for the data needed for one line item.
Sounds easy......but I thought that many times before with this Filemaker stuff.
BTW. Thanks for the help last week with the CVL.