5 Replies Latest reply on Jan 29, 2015 10:23 PM by Salem

    Building a script for Monthly Report

    Salem

      Title

      Building a script for Monthly Report

      Post

      Hi,

      I am trying to build a report, which only compiles data, that dates the previous month of the current month. I am looking in building a script that will automatically execute everytime I run this report. Problem is, I am clueless on how to even begin. Please help.

      Thanks.

        • 1. Re: Building a script for Monthly Report
          SteveMartino

          Without knowing anything about your database, it's design and the data that would be needed to create a report, it's almost impossible to give you a detailed answer.

          Easiest would be to search this website and others like it for some basic help.

          Also, FileMaker has training materials which will give you the basics for reporting.  There are many books, videos (purchase or youtube) with relevant information.

          The basic idea would be this:

          Create a report layout.  You will usually need a header, sub summary part, and maybe a body part (if you need to see individual records instead of just the group of records). 

          Your script could be a button on another layout.

          The script should do some basic things:

          1.  Create a found set of records you want to summarize on the report (unless you already have done that).  This could be a simple find of records from the previous month

          2.  Go to the report layout.

          3.  Sort the records by the field in the sub summary part.

          It may be easiest to open up something like the Invoice Starter Solution and see how they set up a report layout, and the script that takes you there.

          • 2. Re: Building a script for Monthly Report
            philmodjunk

            A tutorial on Summary Reports: Creating Filemaker Pro summary reports--Tutorial

            A Thread of Scripted Find Examples--which can be used to find and sort the records for your summary report: Scripted Find Examples

            • 3. Re: Building a script for Monthly Report
              Salem

              Hi Phil, Steve,

              My apologies for vague description on my issue.

              My objectives is to generate a Monthly report whereby at a primary level, will be differentiated by various Projects. There are then 7 different criterias from which I have to pull from 7 separate tables. I have resorted into using Portals, to help me segregate all this categories individually.

              I wrote a script to help me pull data for previous month as follows :-

              ###################################################################

              Enter Find Mode []

              Set Variable [$month; Value:Let([m=Month(Get(CurrentDate))-1;
              m=If(m=0;12;m);

              y=Year(Get(CurrentDate))-If(m=12;1)];

              m&"/"&y)]

              Set Error Capture [On]

              Perform [Specified Find Requests; Find Records; Criteria: site_diary::date :"=$month"]
              [Restore]
              Exit Script []

              #########################################################################################

              Now with this I am able to sort data for previous month (only) accurately, but the script does not take effect on portals. My portal sections does not filter data by previous month. Do I have to separately set filtering criteria for each portals ?

              Hope you guys can help me out.

              • 4. Re: Building a script for Monthly Report
                philmodjunk

                When you perform a find, you are finding records in the layout's table, not the portals. Once those records are found, the relationship and portal filters you have set up control what appears in your portals.

                And I recommend that you look at those scripted find examples for a better way to set up your find script. What you have works, but it can be a bit of a pain to review in the script editor as the criteria are hidden inside dialog boxes that you have to open to read when the method shown in my examples keeps all the criteria immediately visible in the script editor.

                • 5. Re: Building a script for Monthly Report
                  Salem

                  Thanks Phil. Will give it a go.