9 Replies Latest reply on Oct 18, 2013 11:16 AM by dansan500

    Data from one database to another

    dansan500

      Title

      Data from one database to another

      Post

           I have two databases:

           C4shipping_1

           C4shipping_2

           from C4shipping_2,  I have set the Data source to access C4shipping_1 and I have the fields set as calculations to load data from C4shipping_1

           All I need to do now is: when a sales order is written in C4shipping_1, I need the Sales_Order# to write the Sales_Order# in  C4shipping_2 

           I know the Open File command, but how to I load the data?

           Can you help me.?

        • 1. Re: Data from one database to another
          philmodjunk

               What is the purpose of having two files like this? What problem does it solve for you?

               Perform Script can be used in a script or button setup in C4Shipping_1 to perform a script defined in C4Shipping_2 and can pass this data to that script as a script parameter. That script can then use set field with the Get ( ScriptParameter ) function to set the match field to this value.

          • 2. Re: Data from one database to another
            dansan500

                 We are writing shipping information to a third party Fedex, UPS shipping program. We have the ODBC turned on and hooked to the program. It works but it takes too long to search for the data. My thoughts were if i could create a small lite-weight database I could pull from that to speed the data transfer when the sales order was searched for in the third party system..

            • 3. Re: Data from one database to another
              philmodjunk

                   Ok, but I don't see where using two FileMaker files makes this any faster, it could even be a bit slower.

              • 4. Re: Data from one database to another
                dansan500

                     Is there a way i can write to a field in another database?

                • 5. Re: Data from one database to another
                  dansan500

                       Would it be:

                       Open File [Open hidden;"C4shipping_1"]

                       and then perform a script to somehow write the file

                       Then Close File ["C4shipping_1"]

                  • 6. Re: Data from one database to another
                    philmodjunk
                         

                              Is there a way i can write to a field in another database?

                         the perform script method is one way. And it will also open the file so you do not need to use Open file with it.

                         The script being performed is in the other file, it can simply use set field to set the data to a field in a record of that file's table, but it may first have to find the correct record--depending on the design of your database.

                         It's not the only way. If File 1 has an external data source reference to a table in File 2, a script in File 1 can sue set field to directly set a field in File 2 to a value.

                         A lot depends on exactly what you want File 2 to do with the data sent to it.

                    • 7. Re: Data from one database to another
                      dansan500

                           Yeah, all I need for it to do is:

                           pull from a field in Dbase1 and then, create a record then write it to a single field in Dbase2

                      • 8. Re: Data from one database to another
                        philmodjunk

                             Script (or button) in File 1:

                             Perform Script [ "Create New Record" from File 2 ; Table::Field ]

                             Script defined in File 2:

                             New Record/Request
                             Set Field [Table::Field ; Get ( ScriptParameter ) ]

                             replace Table::Field with a reference to the field that holds the data you want to enter into the new record created in File 2.

                             And it is not impossible that if you defined an external data source reference to the Table in file 2 in file 1 that the correct relationship with "allow creation..." enabled that you could reduce this to a single line script in File 1 instead:

                             Set Field [TableFromFile2::Field ; TableFromFile1::Field ]

                        • 9. Re: Data from one database to another
                          dansan500

                               Thank You