May 7, 200718 yr I was wondering how to create a button that removes an entry from the database and automatically archives it in a separate file linked to the database. The only function that I could find was removing an entry entirely, but I was wondering if there was any way to move the file to another database rather than delete it.
May 7, 200718 yr Yes, you can either use Import to create a new record in the Archive file, or you can use multiple Set Field steps, to set the multiple fields in a new record in the Archive file. There are pros and cons to each method. ALWAYS backup immediately before trying anything like this. 1. Import Pros: If you have a lot of fields, it's the easiest. Cons: You must isolate the Main file to show ONLY 1 record before you call the Import script in the Archive file, or you'll get the whole found set. Which you may or may not want. Main File: Show All Records Omit Record Show Omitted Only (or use a global ID field and self-relationship) Call script in Archive Archive: Import from Main Main: Delete Record 2. Set Field Pros: It's difficult to go wrong, and if it does, there's less damage. You don't have to change the found set in the Main file. Cons: You have to set each field. If you want to do the found set, you'd need to Go To Record/Request [First], then enclose the below in a Loop (with an Exit after Last). It's slower than Import. It requires a relationship between the files, on the ID. Main: Set Field [ global ID field in Archive, Main ID ] Call script in Archive Archive: New Record Set Field [ ID; global ID ] Exit Record (needed before using the relationship) Set Field [ Field 1, ID relationship_to_Main::Field1 ] Set Field [ Field 2, ID relationship_to_Main::Field2 ] etc. Exit Record Main: Delete Record In either case you would likely want some error capture and testing, just to sure that everything went according to plan, before either Importing or Deleting.
May 7, 200718 yr I would do it differently. I'd keep the data in the original file, and instead change the status of the record to "Inactive" or something. Then you'd just need to adjust the Finds and relationships to show only "Active" records. This allows you to use the same file for both, making field and interface changes consistent. If you wish, this also allows users to search for "Inactive" records instead, just by changing the Status to search for in the Find or relationship filter.
Create an account or sign in to comment