4 Replies Latest reply on Feb 9, 2011 2:21 PM by philmodjunk

    Printing a Report based on line items table

    dg3321

      Title

      Printing a Report based on line items table

      Post

      I have created a list report based on a line items table so i can view all entries in a portal.  This report also contains related fields which i have placed in the header. 

      My question is:  When i am in the parent record, how do i create a script to go to the exact record (and said record's line items in the portal) in the list report?  Currently, i have set up a quickfind in the list report where i can search a specific record (which produces all of the line items for the record searched), and then i can print.

      I want to eliminate the 'find' and put it into a script.  I need to know how to basically say (while in the parent record):

      If field A = blue, go to list report and show me the blue record and all of the line items in the portal

      Note: 'field A could equal 1 of 11 current records'.  i basically want the program to see what record i'm browsing and then (via a button/script) go directly to my list report showing that record and line items.

      Thanks.

        • 1. Re: Printing a Report based on line items table
          philmodjunk

          Assuming that key field is named "InvoiceID" and that the parent table is named "Invoices", your script would look like this:

          Set Variable [$InvoiceID; Value: Invoices::invoiceID]
          Go To layout [LineItems ]//select the layout you have in your file here
          Enter Find Mode[]
          Set Field [LineItems::InvoiceID ; $InvoiceID]
          Set Error Capture [on] //keeps dialog box from interrupting the script if there are no line item records to find
          Perform find[]

          • 2. Re: Printing a Report based on line items table
            dg3321

            Thanks so much for your quick response.

            I hit a snag on the 4th line of the script: "Set Field [LineItems::InvoiceID ; $InvoiceID]"

            When you say 'LineItems', are you referring to the original line items table/layout or are you referring to my new list report layout?  B/c if you are referring to my new list report, that does not have its own table, and thus is not listed.  The list report shows records from the line items table.

            If you are in fact referring to the original line items table, i tried that, but when i tested the script it took me to the line items layout (not the list report) and was automatically entered into find mode.

            Let me know.

            Thanks!

            • 3. Re: Printing a Report based on line items table
              davidhead

              Why would you not use a Go to Related Records script step using the portal relationship and specifying the list layout?

              TS_Oz, FileMaker Inc.

              • 4. Re: Printing a Report based on line items table
                philmodjunk

                @TS Oz

                Go To Related Records also works. It can, however, be a bit harder to accurately describe in a forum post when you don't know the exact names of the table occurrences involved. The end result, from the user's perspective, is the same.

                @dg3321

                LineItems is my guess as to the name of the table on which you've based your layout. Please select the actual table occurrence and field name that you've actually used in your database.