AnsweredAssumed Answered

Copy data between tables IF

Question asked by RBowering on Apr 28, 2013
Latest reply on Apr 29, 2013 by RBowering

Title

Copy data between tables IF

Post

I have two similar tables. One is local to the FMP12 file and I use it for data entry, sales management, reports. There is a similar table I access via ODBC on a MySQL server which contains as much data as needed so it can be queried and used by php on my website

When I create a new product, I enter all the data in the local table and it's linked child table

Then I have to manually copy certain fields to the ODBC table plus add a few dummy values there to keep the MySQL validations happy. Part of the data entry includes copying the main ID field from table 1 to ODBC table

I would like a script to:
Check to see if an ID exists in both tables
If it does, then end the script
If it doesn't then 
Create new record in ODBC table and copy fields A, B, C, D, E and enter certain data into the two mandatory 'other fields

This would be a one record at a time activity - not a loop through the whole dataset. I would put a button on my main data entry table; enter my original data then click the button to fire the script to copy the data across. It'd be even cooler if the button was disabled when there was already a matching record

Outcomes