2 Replies Latest reply on Dec 22, 2014 1:08 PM by philmodjunk

    Script to find all PO's received in current month

    jebber6685

      Title

      Script to find all PO's received in current month

      Post

      I have a database that tracks customer projects. I have a field called PO Date that is the date the PO was received for that project. I want to create a script that when activated will find all records that have a date in the current month for the PO Date field. In other words, script that will return all PO's that have been received in the current month.

      I have been doing this manually, ( 12/1/14...12/31/14 ) but having script that I could attached to a button would be nice.

      What is the most efficient way to do this?

      Any help here would be greatly  appreciated.
      I have FMPro Advanced 13.0 v4
      OS - Windows 7

       

        • 1. Re: Script to find all PO's received in current month
          FentonJones

          A calculation to see the last date of a month is "1st date of next month - 1". 
          [ FileMaker will automatically figure out what month and year (if needed).]

          1st date of next month: Date ( Month (Date_)+1; 1; Year ( Date_ ))
          Last date of month: Date ( Month (Date_)+1; 1; Year ( Date_ )) - 1
          1st date of month: Date ( Month (Date_); 1; Year ( Date_ ))

          [ I just remembered, a rather odd calculation for the "last date of month": Date ( Month (Date_)+1; 0; Year ( Date_ )) ]

          To know what the above is for the "current date", use: Get (CurrentDate)
          [ instead of "Date_" above, and set its "Storage Options" to "Do not store" (etc.) ]

          • 2. Re: Script to find all PO's received in current month
            philmodjunk

            Even simpler:

            Enter FInd mode []

            Set Field [YourTable::YourdateField ; Month ( Get ( CurrentDate ) ) & "/" & Year ( Get ( CurrentDate ) ) ]
            Perform Find []

            For this month, that will enter 12/2014 as search criteria and you'll get all records dated in the month of December 2014.