On Sep 16, 2010, at 9:15 AM, Bill Wallace wrote:
I have been going through the filemaker knowledge base but cannot
seem to find a solution to counting days. I would like to be able to
count the days in a script so that when a student has a book out for
21 days or more from the checkout date. Then I would be able to red
flag the student, until the book is returned.
If you enter a checkout date for a book, when the book comes back what
do you do? Remove the checkout date?
If so, define a field like the following:
late_flag - (Calculation, Text Result, storage options= unstored) =
If(not IsEmpty(checkout_date) and (checkout_date +21) <
Get(CurrentDate), "Late", "")
Since this is an unstored calculated field, if you do finds on it with
a ton of records, it will definitely lag. This is best just to display
on layout for a visual or use to highlight records (late_flag = "Late").
To script a find for offending records, difine a script like this:
Allow User Abort [Off]
Set Error Capture [On]
Enter Find Mode []
Set Field [ checkout_date , GetAsText("<" & Get(CurrentDate) - 21) ]
Perform Find[]
If[ Get ( FoundCount ) = 0 ]
Show Message [ "There are no books later that 21 days!" Choice #1 =
OK ]
End If
That should be enough to get you going in the right direction.
Good luck and I hope this helps!
Don Wieland
D W D a t a C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
[email protected]
Direct Line - (949) 336-4828
Integrated data solutions to fit your business needs.
Need assistance in dialing in your FileMaker solution? Check out our
Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.html
Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro
9 or higher
http://www.appointment10.com
For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html