AnsweredAssumed Answered

find records in a date range

Question asked by KBGF75 on Sep 24, 2011
Latest reply on Sep 26, 2011 by KBGF75

Title

find records in a date range

Post

        In my FMP7 file the Donations file contains records of donor gifts over a period of years. I want a script that will find all donation records in a specified date range. My approach has been to create a global field in the table, “Date_range_for_find”.  The user would first enter the date range in that field, then execute the script. 

      When this script can be made reliable, I plan to add more scripts that will use other search criteria but with the same date range. That’s why I chose to have the user specify the date range in its own field. This field is formatted for text, as I couldn’t make it work when formatted for date. A copy of the script is below.

     The script worked once, finding 259 records in a date range of 1/1/2009..12/31/2009.  Then I changed the date range field, but subsequent runs of the script seemed to find the same 259 records.

     Evidently the script (below) retains the initial date-range value, rather than using current contents of the date range field.  What am I doing wrong? Did it just memorize an earlier find command?

      -Al

 Enter Find Mode [ Specified Find Requests: Find Records; Criteria: Donations::Date of donation: "1/1/2009..12/31/2009" ]

Go to Layout [ "Donation Data Entry" (Donations) ]

Go to Field [ Donations::Date of donation ]

Set Field [ Donations::Date of donation; Donations::Date of donation = Donations::Date_range_for_find ]

Set Error Capture [ On ]

Perform Find [ Specified Find Requests: Find Records; Criteria: Donations::Date of donation: "1/1/2009..12/31/2009" ]

[ Restore ]

Go to Layout [ "Donation Reports" (Donations) ]

Set Error Capture [ Off ]

Outcomes