December 4, 200322 yr Hi all, I'm trying to write a small script that checks if the content of a Date Field has a value that is two days over. Erm example Three records... and today's date is 12/4/03 12/2/03 12/6/03 12/4/03 I would want my script's If statement to accept 12/2/03. I hope that make sense, because I'm feeling quite funky today. Cheers, Steve Griff
December 4, 200322 yr Hi Steve, Here is the solution, Go to record [First] Loop If[Today-2 = Date] set field["result", "Date"] End if Go to record [Exit after last, Next] End Loop Regards, Henry
December 4, 200322 yr You can also just have an extra calculation field that would do the same thing and would be fast and searchable. cIsDue Number field): MyDate + 2 = status(currentDate) will return true, a '1' when the date is too days old. Charles
December 5, 200322 yr Oh, ya, thanks for advice. Status(currentdate) is the right function to get the date. Regards, Henry
December 5, 200322 yr Hi: I suggest using a find script. That way the loop doesn't have to initially loop through all the records in the db which could take a while. Rather than explain the whole thing, I whipped up this file in a couple of minutes to give an example. It is a real simple file. Once you do the find script, your script can then do the loop stuff since the found set will be smaller than the total, and the loop won't take so much time. Ken PS!! I misread your post. Sorry. My script is greater than or equal to today - 2. But you said just two days ago. Just change the "<=" to "=" in the script and it should be fine. Find Example.zip
Create an account or sign in to comment