Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Is there a way in the data calculation that would delete a record if it was more than 2 days old. If so could someone please write me up a sample. (Hopefully it will be a easy one.)

Thank you in advance

Posted

Are you sure you want to delete records? Will you *never* want to report on historical data?

Better to add a number field (call it "obsolete"). This type of field is called a "flag" field which contains a 1 if the record is to be considered obsolete.

Create a script named "Open":

Go to Layout (YourLayout)

Enter Find Mode()

Set Field[YourDateField; "<" & Get(CurrentDate) - 2]

Perform Find[]

Replace Field Contents[No dialog; obsolete; 1]

Show Omitted

Choose File Options... from the File menu.

Check the Perform Script checkbox and select Open.

This will run the script when the file is opened, and set the obsolete flag to 1 for records older than 2 days, and then show only the ones which are not obsolete.

Posted

Yes, I am sure I do not need any historical data on this. A script like this one will not be needed because I can always do a search base on the date that it was created and then delete those found records. I usually do this every two days but this is becoming cumbersome.

Are you sure you want to delete records? Will you *never* want to report on historical data?

Better to add a number field (call it "obsolete"). This type of field is called a "flag" field which contains a 1 if the record is to be considered obsolete.

Create a script named "Open":

Go to Layout (YourLayout)

Enter Find Mode()

Set Field[YourDateField; "<" & Get(CurrentDate) - 2]

Perform Find[]

Replace Field Contents[No dialog; obsolete; 1]

Show Omitted

Choose File Options... from the File menu.

Check the Perform Script checkbox and select Open.

This will run the script when the file is opened, and set the obsolete flag to 1 for records older than 2 days, and then show only the ones which are not obsolete.

Posted

Whether or not it's a good idea to delete records, why would you want to? You can always write a script that runs when the file opens tht shows you the records you need to see.

RW

Posted

Well, if you're sure:


Go to Layout (YourLayout)

Enter Find Mode()

Set Field[YourDateField; "<" & Get(CurrentDate) - 2]

Perform Find[]

Delete All Records[No Dialog]

Show All Records

The Delete All Records step deletes only the found set.

You can attach the script to a button or run it on startup.

This topic is 4680 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.