In your print step, specify the "current record" option and the script will then only print the current record instead of the "records being browsed" (also known as your found set).
Thanks for the quick response
I thought this was pretty stright forward however, I do not see "current record" option anywhere in the Print set up or Print Setup. Or have I mis understood your post.
Well, I found it as part of the print setup however, it still prints all of the records. Maybe further explination of what I'm trying to do is in order. Here goes - I have a sales table that is related to a product table. The sales table has a portal linked to the product and used to look up product from the product table and insert it into the sales table creating a sales record.
Now I want to print a simple sales receipt showing the products purchased. My thought was that: have a button on the page that would print a report layout showing the sales and total and any balance due.
Tried writing this simple script to do the work:
Go to Layout ["Sales - Receipt" (Customer)]
Print [Restore: hp Laserjet 1320 series [D6ECC3]]
Go to Layout [original layout]
What am I missing? My relation ship is as follows:
The look up works perfectly with this relationship for inserting records into the sales table.
Thanks again for all of your responses to this issue.
Why would your layout for a receipt be based on the customer table? Can't a customer have more than one receipt?
The record you have as "current", the found set, the sort order on a layout based on one table, does not automatically affect what record is current, the found set and sort order on a layout based on a different table (or even the same table, but referring to a different table occurrence "box" in Show Records From).
An invoicing system usually has these tables:
and an Invoice layout will then usually have a portal to LineItems for listing each item purchased in the same sales transaction. Often, invoices are printed from a list layout based on teh LineItems layout. You can find an example of this approach in the Invoices Starter solution or in the simple demo file for which I will include a link at the bottom of this post. It was created by a guy who goes by "Comment" in several forums and is one of the most widely respectd FileMaker experts out there.
With such a set up, a script performed from the Invoices layout must pull up the required found set of LineItem records for the current invoice before printing them with the records being browsed option (not current record in this case). The script can use Go To Related Records or Perform a find to do that. Here's a Go To Related Records example:
If [ Not IsEmpty ( LineItems::InvoiceID ) // make sure the there are LineItems to print ]
Go To Related Record [Show only related records; From table: LineItems; Using layout: "InvoicePrint" (LineItems)]
Sort [Restore ; no dialog ] // may not be needed, depends on your design
Print [Restore ; no dialog]
The Demo file: http://fmforums.com/forum/showpost.php?post/309136/
Thanks again the D/L of the demo file put me on the right track. I also created a lineitem table and now all is working fine. Printing the sales report I wanted. I learned alot here and appreciate all of your help.