3 Replies Latest reply on Sep 15, 2011 12:00 PM by philmodjunk

    Script for multiple inserts

    MikeEdwards

      Title

      Script for multiple inserts

      Post

      Is there any possibilty I could utilize a script that would (for lack of a better word) export the contents  of 5 number fields to a new record of 5 number fields in another table?

        • 1. Re: Script for multiple inserts
          philmodjunk

          Yes.

          How you design your system (tables all in one file or in two separate files, related tables or unrelated, 5 fields from 5 different records or 5 fields from the same record...) will determine the exact details, but this can be done.

          Also, depending on the reason why you want to do this, it may be that you don't need to export this data at all but merely link to it.

          • 2. Re: Script for multiple inserts
            MikeEdwards

             Two seperate unrelated tables. 5 quantity fields specific to a part # from one record to be exported 5 generic quantity fields to a new record.

            There are 5 part #s with their own 5 quatity fields on one record in the first table. I'd to be able to export 1, 3 or all 5 (of the group of 5) to 1, 3 or 5 new records in the second table.

            • 3. Re: Script for multiple inserts
              philmodjunk

              Assuming that your tables are both in the same file, this script does so for one field. Doing it for more just requires a few more steps added to the script:

              Set variable [$PartNo ; value: YourTable1::Partnumberfield1]
              Freeze Window
              Go to layout [//select layout for second table]
              New Record/Request
              Set Field [Yourtable2::partNumberField ; $PartNo ]
              Go To Layout [original layout]

              To do this for multiple fields at one time, you can either use different variables for each field or you can build a list of the numbers in one field. Either way you script then creates a new record for each part number and uses set field to assign the value from a variable to the part number field.