Newbies SnetCo Posted January 14, 2002 Newbies Share Posted January 14, 2002 To create a sales tax report for the previous month sales, I have a script that finds records that were paid say "3/1...3/31" which finds them for March of the current year. It works great until I get to January. I don't want the user to have to enter 12/1/01...12/31/01. I want to be able to click a button for December and find all the previous December's records, no matter what year it is. This will always be done before the 20th of the following month. I hope this makes sense, this is my first post. Link to comment Share on other sites More sharing options...
Steven H. Blackwell Posted January 14, 2002 Share Posted January 14, 2002 quote: Originally posted by Janet McDonald: To create a sales tax report for the previous month sales, I have a script that finds records that were paid say "3/1...3/31" which finds them for March of the current year. It works great until I get to January. I don't want the user to have to enter 12/1/01...12/31/01. I want to be able to click a button for December and find all the previous December's records, no matter what year it is. This will always be done before the 20th of the following month. I hope this makes sense, this is my first post. There are at least two different ways to do this. What operating system are you using? Old Advance Man Link to comment Share on other sites More sharing options...
Newbies SnetCo Posted January 15, 2002 Author Newbies Share Posted January 15, 2002 I'm on a Mac, system 9 with FM PRO 5. Link to comment Share on other sites More sharing options...
Steven H. Blackwell Posted January 15, 2002 Share Posted January 15, 2002 OK, you can use an AppleScript, and I will post it in a little while. Old Advance Man Link to comment Share on other sites More sharing options...
Newbies SnetCo Posted January 15, 2002 Author Newbies Share Posted January 15, 2002 Thank You! Link to comment Share on other sites More sharing options...
Steven H. Blackwell Posted January 15, 2002 Share Posted January 15, 2002 Let's do this the easy way, at least for now. Assume that you already have a field called "date" that contains the date you're tracking. Define two new calculation fields (type number) one of which is called "year" and is equal to (Year of date) and the other of which is called "month" and is equal to (Month of date). THese functions are found in the Calculation functions under the date heading. Then for December only, create a Perform AppleScript ScriptMaker step that has this code. Watch the line wrap: set theDate to current date set theYear to (year of theDate) as string tell application "FileMaker Pro" show (every record of database 1 whose cell "Year" = (theYear - 1) and cell "month" = 12) end tell When this script is run for December of last year's records in January of this year, it will return all the December 2001 records. Sooner or later you may want to address the issue of multiple years, and a lot of them, but this will work for now. There are oither ways to do this as well, including just doing a scripted Find on the Year and Month fields, but this solution will work. HTH Old Advance Man Link to comment Share on other sites More sharing options...
Thom Posted January 15, 2002 Share Posted January 15, 2002 Write a ScriptMaker script called "Find Last Month": Enter Find Mode [] Insert Calculated Result [ dateField, Link to comment Share on other sites More sharing options...
Newbies SnetCo Posted January 23, 2002 Author Newbies Share Posted January 23, 2002 It works great. Thank you all for your input. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 8101 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now