Jump to content

Delete records older than 1 year


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

Recommended Posts

Go to Layout [{one with the date field on it}]

Enter Find Mode [ ]

Insert Calculated Result [date, "<" & DateToText(Date(Month(Status(CurrentDate)), Day(Status(CurrentDate)), Year(Status(CurrentDate)) -1))]

Perform Find [ ]

Delete All Records [No dialog]

Link to comment
Share on other sites

Sorry, didn't notice you were on v7. Replace the commas in the Date function with semicolons and Status(CurrentDate) with Get(CurrentDate) and DateToText with GetAsText.

Link to comment
Share on other sites

Hi. Thanks for the help. I created the script but I do have one question. Was i supposed to create a date field for each record so that the script can determine how old the record is or does Filemaker keep a hidden record of when each reocord was added. I ask this because you can see what the script is doin when it runs; it asks for records older than one year in the find field but it looks like it is just searching one paricular field, and that particular field does not contain a date.

FileMaker Version: 7

Platform: Mac OS X Panther

Link to comment
Share on other sites

You need a date field with an auto-entered Creation Date. Use that field in place of 'date' when you specify the field in the Insert Calculated Result step.

Link to comment
Share on other sites

You still need a date field.

This field needs to be accessible for a find. You can create a layout just for this purpose, and depending upon your solution, hide this layout from the list.

If you want this field to be unaccessible at all, then you'd need a Range relationship, but it seems way too complicated for such a simple task.

Link to comment
Share on other sites

You can put it on a layout, disallow entry, set it with no borders, a text color equal to the background, and make it as small as you like (5x5 pixels might be a good size). Then it will be available for the Insert step, but inaccessible and invisible to users.

Link to comment
Share on other sites

Hi again,

Just in case.

Create :

- a global text field gRange

- a relationship SjByRange gRange::YourDateField.

Then a script

SetField[gRange, DateToText(Date(1, 1, Year(Status(CurrentDate))))]

Loop

EndLoopIf[substitute(RightWords(Substitute(gRange,"/","A"),1),"A","/")=DateToText(Status(CurrentDate))]

SetField[gRange & "

Link to comment
Share on other sites

This topic is 6476 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
 Share

×
×
  • Create New...

Important Information

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