Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

delete records older than a date

Featured Replies

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

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...
  • 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.

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

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

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

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.