How can I (partially) automate the transfer of a FileMaker database structure and field contents to a second database?

StackOverflow https://stackoverflow.com/questions/1983275

  •  22-09-2019
  •  | 
  •  

Question

I'm trying to copy some field values to a duplicate database. One record at a time. This is used for history and so I can delete some records in the original database to keep it fast.

I don't want to manually save the values in a variable because there are hundreds of fields. So I want to go to the first field, save the field name and value and then go over to the other database and save the data. Then run a 'Go to Next Field' and loop through all the fields.

This works perfectly, but here is the problem: When a field is a calculation you cannot tab into it and therefore 'Go to Next Field' doesn't work. It skips it.

I though of doing a 'Go to Object' but then I need to name all the objects and I can't find a script to name objects.

Can anyone out there think of a solution?

Thanks!

Was it helpful?

Solution

This is one of those problems where I always found it easier to do an export/import.

Export all the data you want from the one database, and then import it into the other database. All you need to do is:

  • Manually specify which fields you want to copy
  • Map the data from the export to the right fields in the new database/table

You can even write a script to do these things for you.

OTHER TIPS

There are several ways to achieve this.

To make a "history file", I have found there are several cases out there, so lets take a look.

CASE ONE Single file I just want to "keep" a very large file with historical data, because I need to erease all data in my Main file.

In this case, you should create a "clone" table (in the same file ore in other file, is the same). Then change any calculation field to the type of the calculation result (number, text, date, an so on...). Remove any "auto entered value or calculation from any field, like auto number, auto creation date, etc..). You will have a "Plain Table" with no calculations or auto entered data.

Then add a field to control duplicate data. If you have lets say an invoice number (unique) for each record, you can do this to achieve this task. But if you do not have a unique field that identifies the record as unique, then you have to create one...

To create such a field, I recommed to add a new field on the clone table and set as an aunto entered calculation and make a field combination that is unique... somthing like this: invoiceNumber & "-" & lineNumber & "-" " & date.

On the clone table make shure that validation is set up for "always", and no empty values allowed and that this value is unique.

Once you setup the clone table... then you can import your records, making sure that the auto enty option is on. Yo can do it as many times as you like, new records will be added and no duplicates.

If you want, can make a Script to do the move to historical table all the current records before deleting them.

NOTE: This technique works fine when the data you try to keep do not have changes over time. This means, once the record is created is has no changes.

CASE TWO A historical table must be created but some fields are updated.

In the beginnig I thougth a historical data, never changes. In some cases I found this is not the case, like the case I want to track historical invoices but at the same time, keep track if they are paid or not...

In this case you may use the same technique above, but instead of importing data... you must update data based on the "unique" fields that identifiy the record.

Hope this technique helps

FileMaker's FieldNames() function, along with GetField() can give you a list of field names and then their values

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top