2 Replies Latest reply on Sep 4, 2009 10:36 AM by jla_1

    Scripting to copy data 1 table to two table

    jla_1

      Title

      Scripting to copy data 1 table to two table

      Post

      I'm at the tailend of a database and now need to get data that was imported into a table (Import) and copy part of the data to one table with matching fields, and another part of the data to another table.  The tables are like this:

       

      Table with data-

       

      Import::LName,FName,ID,HR,GR,Image

      (There may be more than one record for any particular ID with only the data.jpg changing - ex. kirk,james,1001,12a,12,img1001.jpg - kirk,james,1001,12a,12,img1002.jpg as some students have more than image associated.

       

      The tables and fields I need that copied over to (named the same)

       

      Students::LName,Fname,ID,HR,GR

       

      Images::Image,ID

       

      The ID is the related field so I can display the image no's in a portal on Student Layout.

       

      So far I was trying something like:

       

      • Go to Record/Request/Page[ Next; Exit after last ]
      • Loop
      • Set Variable [ $name; Value:IMPORT::Fname ]
      • Set Variable [ $lname; Value:IMPORT::Lname ]
      • Set Variable [ $id; Value:IMPORT::ID ]
      • Go to Layout [ “STUDENTS” (STUDENTS) ]
      • New Record/Request
      • Set Field [ STUDENTS::Fname; $name ]
      • Set Field [ STUDENTS::Lname; $lname ]
      • Set Field [ STUDENTS::ID; $id ]
      • Go to Layout [ “IMPORT CSV” (IMPORT CSV) ]
      • End Loop
       
      I wasn't finished it because when I tested it's duplicating the id's causing errors, also I'm not sure how to do it so it sends the data to both tables, yet matches the id's up.