6 Replies Latest reply on May 10, 2013 5:29 AM by mikebeargie

    I Need to transfer the data from one table to another table

    Ragupathi

      HI i need to transfer the data from one table to anothertable

      without uploading data it should go automaticly the reason is i just created the HR Database

      for that status = "Active" or "New join" or "Terminated "

      if status = Terminated then automaticly move the data from one table to another table (with Same field) and deleted from HR database . for that what i need to do i want created the completed duplicted table or if i created the duplicted layout it will work or not

       

       

      thanks & Regards

        • 1. Re: I Need to transfer the data from one table to another table
          mikebeargie

          You're question isn't really clear.

           

          Are you just trying to duplicate layout, and a duplicate table, and move all the data from the first table to the duplicated table?

           

          If you just duplicated the table, you can just export the records from the first table, and import it straight back into the duplicate table.

           

          Do you need to automate this process? Can you provide more details?

          • 2. Re: I Need to transfer the data from one table to another table
            Ragupathi

            Hi Mike Beargie

             

                           I just want to upload only one data

            eg: Field name (Status )="New Join " or "Active" or "Terminated"... If status = Terminated then only current record should move to another will all fields and deleted from main table. for that i tried below of the Script

            Enter Find Mode []

            Set Field [Status::perssonal]

            Perform Find ["Terminated"]

             

            HR database:

            Peform Script [“Status"]

            Import Records [No dialog, "Perssonal"]

             

            but its not working

            • 3. Re: I Need to transfer the data from one table to another table
              mikebeargie

              Are your two tables in the same database or a different database?

               

              SAME DATABASE:

              Enter find mode

              set field status::personal = "terminated"

              perform find

              set variable $path = "file:" & get(temporaryPath) & "temp.fmp12"

              export records as filemaker file to $path

              delete found records

              go to layout for new table

              import records from file $path

               

              DIFFERENT DATABASE:

              Enter find mode

              set field status::personal = "terminated"

              perform find

              set variable $path = "file:" & get(temporaryPath) & "temp.fmp12"

              export records as filemaker file to $path

              delete found records

              open file (second file)

              perform script (second file import)

                    go to layout (new table)

                    set variable $path = "file:" & get(temporaryPath) & "temp.fmp12"

                    Import records (from $path)

              Close file (second file, to return to first, optional)

               

              This is the general structure to use a temp file to export records from one table, and import to the other. You will have to tailor the steps and add any error checking you need to work in your solution.

              • 4. Re: I Need to transfer the data from one table to another table
                Ragupathi

                Hello Mike Beargie

                                              Thanks lots it working fine.

                thank you very much to respond my post...

                • 5. Re: I Need to transfer the data from one table to another table
                  Ragupathi

                  Hello Mike Beargie

                   

                            sorry for disturb now i am facing small error regards the data transfer to one table to another table

                  My Script below mention with error

                   

                  Enter Find Mode[]

                  Set Field [Personnel Records ::Status ; "Terminated"]

                  Perform Find []

                  Set Variable ["$Ragu"; Value:Get (TemporaryPath) & "DB.fmp12"

                  Export Records ["$Ragu"; Windows (ANSI)

                  Deleted Record /Request []

                  Go to Layout ["Terminated Details " (Personnel Records)]

                  Import Records [No dialog ; "$Ragu "; Add; Windows (ANSI)]

                   

                  but i Am facing one error below

                   

                  The file "$Ragu " could not be found and is required to complete this operation 

                   

                   

                  can you help me in this case

                   

                  Thanks & Regards

                  Ragu

                  • 6. Re: I Need to transfer the data from one table to another table
                    mikebeargie

                    Try changing this:

                    Set Variable ["$Ragu"; Value:Get (TemporaryPath) & "DB.fmp12"

                     

                    to this:

                    Set Variable ["$Ragu"; Value: "file:" & Get (TemporaryPath) & "DB.fmp12"]

                     

                    Refer to this for the above:

                    http://www.filemaker.com/11help/html/create_db.8.32.html

                     

                    And changing this

                    Import Records [No dialog ; "$Ragu "; Add; Windows (ANSI)]

                     

                    to this (remove that space)

                    Import Records [No dialog ; "$Ragu"; Add; Windows (ANSI)]

                     

                    Also, during your testing phase, do everything with the "no dialog" box UNchecked, you want to see the dialogs to make sure everything is going as planned. Also the script debugger should always be open.

                     

                    Lastly, since you're deleting records, I'd highly recommend error checking in your script:

                     

                    Turn error capture on

                    Enter Find Mode[]

                    Set Field [Personnel Records ::Status ; "Terminated"]

                    Perform Find []

                    If [get(lastError) = 401]

                      show custom dialog "error, no records found"

                      exit script

                    end if

                    Set Variable ["$Ragu"; Value:Get (TemporaryPath) & "DB.fmp12"

                    Export Records ["$Ragu"; Windows (ANSI)

                    Delete all Records/Requests []

                    Go to Layout ["Terminated Details " (Personnel Records)]

                    Import Records [No dialog ; "$Ragu "; Add; Windows (ANSI)]