kungx Posted March 28, 2012 Posted March 28, 2012 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
doughemi Posted March 28, 2012 Posted March 28, 2012 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.
kungx Posted March 28, 2012 Author Posted March 28, 2012 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.
Rick Whitelaw Posted March 28, 2012 Posted March 28, 2012 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
doughemi Posted March 28, 2012 Posted March 28, 2012 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now