I don't really understand exactly what you are trying to do here.
You want a seperate page for every item, but what's on that page?
Is it for all kinds of product information?
Is this a sort of attachement to an actual invoice?
Because the example you are giving is a very simple, basic sort of invoice based on the line items table.
You could try this. Have a print script that starts at your list layout.
Go to Record [First]
If (ProductType = "Shirt" )
Go to Layout "Shirt Specification" (a layout that only has the fields relevant for a shirt)
Else If ( (ProductType = "Trousers" )
Go to Layout "Trouser Specification" (a layout that only has the fields relevant for a pair of trousers)
Else If [etc...]
Print (set to print to pdf, current record only, append to existing pdf, no dialogue, etc)
Go to Layout [Original layout] (## Not necessary, of course: I just think this works like my mind works)
Go to Record [Next, exit after last]
DaSaint- Yes, I want a separate page for each item, because Product Type has specific information that is only relevant to that product. For example, Shirt has length of sleeves, pockets, etc, whereas Pants have pant length, waist size, etc. And yes, it is a separate attachment to the Invoice.
Sorbsbuster- That is almost exactly what my script looks like, but I'm still having the problem below.
The issue I am having is that each page is using every Line Item instead of just one Line Item. So for the Line Item 1 (Shirt) it will go to the Shirt Layout and will make a page for Line Item 1 (Shirt), Line Item 2 (Jacket), and Line Item 3 (Shirt). It should only make a page for Line Item 1. After that, it will go to Line Item 2 (Jacket), go to the Jacket Layout and make a page for Line Item 1 (Shirt), Line Item 2 (Jacket), and Line Item 3 (Shirt) - again, duplicating all Line Items instead of just the 1 line item. So maybe its not my script, maybe it's my actual layout? I don't know.
Thank you both so much for responses. Any help would be appreciated.
** Also, here is a photo of 2 of the Product Type pages. As you can see, they have different information that relates only to that particular Product Type.
I don't know the details of your tables and fields but roughly speaking I would guess something like this:
If you go to your Lineitems layout (invoice repot) you need to perforrm a find on the invoice ID to show only the line items for that invoice.
Then you make your invoice as a PDF. I would suggest making a variable that determines the filename. I always store all my files automatically in a folder on the desktop and name tham by invoice date and client name.
The reson for storing on the desktop is because that works on both Windows and Mac. - Get (DesktopPath)
Then when your invoice pdf is made you loop trough the Lineitems one by one, set the Product ID as a variable, Use an IF statement in your script or a calculation with a case statement in another field to determine the layout you need to go to.
Then in that layout you perform a find for your item using it's ID that we stored as a variable.
Once found you create the pdf, append it to the existing pdf usinf the filename variable.
You return to the lineitems table that's only showing the line items for your current invoice and you omit the record you have already saved.
That way you automatically arrive at the next record and the loop repeats. (Set ProductId as variable, determine the layout, go there, perform the find, append, ...
The loop ends when Get (FoundCount) = 0
Should work nicely.
If you need any help with the details let me know.
Did you set the print script step to print 'Current Record only'?
Thanks, I used some of those tips in the script.
I tried that and it worked. What's strange is that I tried that before and it would only print the first record. I think it's because I had it Open the Attachement immediately and it didn't append all the pages so I thought it wasn't working.
Thanks so much!