5 Replies Latest reply on Jul 25, 2015 9:41 AM by philmodjunk

    Printing from a filtered portal.

    GraysonSmith

      Title

      Printing from a filtered portal.

      Post

      I have a database set up for invoices, with a month summary on the start page. I want to be able to print this out. I'm having a hard time with filtering out the records by month in script, which was my idea of how to go about it. Any help?

        • 1. Re: Printing from a filtered portal.
          SteveMartino

          Well that would be the right way.  The start page table is probably not based (actually shouldn't) on the Invoice Table or TO.

          The script should go to the invoices layout, do a find.  That should give you the correct records, then go to the print layout an print.  You may even use a report layout to do the find and print.  What do you have for a script?

          • 2. Re: Printing from a filtered portal.
            GraysonSmith

            -Go to Layout ["Invoices" (Invoices)"]

            -Perform Find [Restore]

                Action: Find Records

                Invoices::Year = Get(CurrentYear)

                AND 

                Invoices::Month = Get(CurrentMonth)

            -Go to Related Record [From table: "Invoices"; Using layout: "Print Invoice" (Invoices); New window]

            -If [Get(SystemPlatform) =3]

                Print [Restore: Select Your Printer]

                Close Window [Current Window]

            -Else

                Enter Preview Mode []

            -End If

            • 3. Re: Printing from a filtered portal.
              SteveMartino

              I don't know exactly what entails a 'month summary', but it should be the same formula that makes it appear on your dashboard.

              Enter Find Mode [ ] //uncheck pause

              Set Field [Invoice::DateField; Date ( Month(Get(CurrentDate))-1;Day(Get(CurrentDate));Year(Get(CurrentDate))) & "..." & Get(CurrentDate)]  //based on today's date 7/24/15, this will give you a range of 6/24/15 to 7/24/15

              Perform Find [ ] //open this dialog and delete previous find

              New Window

              Go to Layout (Print Invoices) //will be the same found set

              If.......rest of your script...

              I would do the find manually, to see the correct amount of records, then run the script with the debugger to make sure the find is correct.

              Edit:  I just noticed something.  Do you have a separate field for month and year on your invoice, or 1 date field and an extra month & year fields on your invoice?

              • 4. Re: Printing from a filtered portal.
                GraysonSmith

                They're seperate fields. I can make them into one field to match your answer however.

                • 5. Re: Printing from a filtered portal.
                  philmodjunk

                  You can't use functions such as Get ( CurrentYear ) or Get ( CurrentMonth ) inside stored find criteria. The expression gets entered as literal text instead of evaluating.

                  Use the other scripting method where you enter find mode and use set field steps to assign values to fields while in find mode in order to set up the needed find criteria.

                  See here for examples of this method: (But you won't need global fields for your date criteria): Scripted Find Examples