5 Replies Latest reply on Aug 6, 2012 3:14 PM by disabled_JackRodgers

    Help Creating a Button

    StewartRitter

      Title

      Help Creating a Button

      Post

      Hello,

      I would like to create a button that takes all the information in a record in table B (name, address, etc), creates a new record in table A that duplicates the information of the record in table B, and then deletes the record in table B. I was thinking about making a custom script and then when the button is clicked, the script will be preformed--but I don't know how to create a script that does this. Could someone please help?

      Thank you.

        • 1. Re: Help Creating a Button
          MarcMcCall

          Use Set Variable all fields you want with Name: $FieldNames   Value: choose the field

          So it will look like this then go to new layout create new record, the use set field for each field with the value as the $FieldName then return to origional layout and delete record.

          • 2. Re: Help Creating a Button
            MarcMcCall

            The set field will look like this

            • 3. Re: Help Creating a Button
              LaRetta_1
              Hi Stewart!  The idea is NOT to move data.  Might a simple flag or Status field work to separate those records? It might be worth considering a small shift in your structure instead.  Moving data around once it is in a table is not standard practice since it defeats the purpose of relational and opens possibility of error inherent with moving data.  Can you explain the purpose?  We might have easier approaches we've used.  :-)
              • 4. Re: Help Creating a Button
                philmodjunk

                I agree, but if you must move data--say to generate a copy that is then modified further, there are two other options:

                Import records can pull one or more records from one table to another.

                You can use the set variable, set field method to just copy the primary key field, but set up a relationship with looked up value settings on all the other fields so that setting the primary key triggers lookups to copy the rest of the data.

                • 5. Re: Help Creating a Button

                  The question is why are you duplicating data in another table and then deleting the record in the first table?  

                  There are any number of valid reasons why you might want to do this.

                  There is also the possibility you need further information on how to use a relational database.

                  For instance, once you've related your invoice table to your customer table, you do not need to have customer address, etc. in the invoice table. You can display that on the invoice form by dragging related fields from the customer table.