Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7607 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

Hi:

I can help cool.gif

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

  • 1 month later...
Posted

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.

Posted

"...it works and it's not even called Date, it's called Fecha..."

Ahhh, that's the *magic* of FileMaker Pro!

Posted

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.

This topic is 7607 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.