3 Replies Latest reply on Jun 25, 2012 1:40 PM by GuyStevens

    copying records from one table to another



      copying records from one table to another


      what would be the best way to copy a record from a table to another table that is basically the exact same, i have records that can be set to active and inactive, once they are set to inactive i would like the records to disapear off to another table and if set to active then they would be copied back.. my reason fro this need is that currently i have a script that when a button "Show all" is clicked that it ask the user if they want t show all records, active records or inactive records, however there are also buttons to show all males and all females, but this includes this inactive records when showing just the females or males... i dont know if there is a better way to filter the showing results but all i really need to do is have things work like this...


      when a user makes a record inactive that record is exiled out of sight out of mind until i open a layout where all the inactive records are stored and only will they begin to show in my foundsets is when they are reactivated... this feels like it should be eay to achive but i just get so confused with all the search/find features that are available.

        • 1. Re: copying records from one table to another

          You can certainly copy records from table A to table B through a number of different methods and you'd need to copy the record, then delete it, but I'd avoid that if possible and it doesn't look necessary here. You might set up a global field or global variable that serves to record the current user preference for whether to show active or inactive records (or whether or not to include the inactive records along with the active...)

          Your user can then specify their preference in this field/variable and your scripts can check the value of this variable in order to perform a find with the correct criteria to be consistent with that stated user preference.

          • 2. Re: copying records from one table to another

            I would definately not start moving things from one table to another.

            If you want to do this in list view or in a normal layout you will need to use finds. You can set a script trigger on the "On Layout Enter" event to perform a find of all active records. So that when you enter that layout only active records are shown.

            You can create finds beforehand and make buttons for them. Like "Find all Male / Female.

            Your find would look for all male or female, depending on the button, and would also include "active" in it's find request. So it would only show all male records that are active.

            You could also create a button to show all Active / inactive.

            Or you could create dropdowns to select sex (male / female) and active setting (active / inactive)

            So you can make any kind of combination of finds.


            If you want to do this in a portal you will need to define your relationships so that only the required records are shown.

            You could make it so that you have a dropdown or a button you can select to show only male or female, active or inactive.


            • 3. Re: copying records from one table to another

              Whoops, My windows was open a while without refreshing. Didn't see your post PhilModJunk, mine says kind of the same.