December 24, 200322 yr I have a field called date. I want to keep in my database records that are no more than 5 monts old. I assume that this can be done by a fm script or applescripts. But the fact is that I have no idea of how to do this. Can anyone help me please? Thanks in advance
December 24, 200322 yr Hi: I can help Doing this with a script would look something like this: Allow User Abort [off] Set Error Capture [on] Go to layout [layout with the date field] Enter Find Mode [ ] - Uncheck "Pause" and "Restore Find Requests" Insert Calculated Result [ "<" & DateToText(Date(Month(Status(CurrentDate)) - 5 , Day(Status(CurrentDate)) , Year(Status(CurrentDate)))) Perform Find [ ] If [status(CurrentFoundCount) = 0] Show Message ["No records were found"] Show All Records Else Delete All Records [Perform without dialog] Have fun! Ken
January 29, 200422 yr Author Thanks a lot, It works! I have a question though... Where are you telling in this script that the field you want to compare is a field called Date, in my case it works and it's not even called Date, it's called Fecha.
January 29, 200422 yr "...it works and it's not even called Date, it's called Fecha..." Ahhh, that's the *magic* of FileMaker Pro!
January 29, 200422 yr Actually he's raised an interesting question...he's basically asking into what field does the insert statement go into? I suspect that the date field in question just happens to be the first field (via tab order) on the layout.
Create an account or sign in to comment