May 27, 200421 yr Newbies I have a database of projects with one of the fields being a "status" field with "completed" as one option. Is there a way to copy a record that is completed to an archive database and then delete the record from the current database?
May 27, 200421 yr Script in your Main file would be something like: Set Error Capture [On] Allow User Abort [Off] Enter Find Mode[] ... unclick pause Set Field [status, "Completed"] Perform Find [ReplaceFoundSet] If [not Status(CurrentFoundCount)] Show Message [button: OK; Message: "No Records Found"] Show All Records Halt Script End If Perform Script [External, (select your archive db here and specify an import script which you will create in your archive file first)] Delete All Records Your import script in archive would be: Import [Restore, Perform without Dialog] ... select your Main file Show All Records With this in place, Mike, you will execute your script in Main, it will find all Completed Records. With the found set isolated, it would then open your archive file and pull (import) only the found records from Main. Your Main script would take over again (which would return you to your Main file) and delete the found set. When the found set is deleted, you will be left on record 1 with all remaining records displayed. If you only wish to archive one record - the one you are viewing, it would be the same basic process but you would not use Find. You would Show All Records, Omit the current record, then Show Omitted (thus isolating it as the only record in a found set), then perform your External script. And you probably would want to add a test to be sure the status is Completed right before performing your External script. Where the If[] is above, instead use: If[status, Status <> "Completed"] ... Show Message ... "You can't archive an Incomplete record." etc. Always back up before trying something new.
May 27, 200421 yr Two other threads, that dealt in the past with the archiving of the deleted records: 1) http://www.fmforums.com/threads/showflat.php?Number=87992 2) http://www.fmforums.com/threads/showflat.php?Number=89096
Create an account or sign in to comment