FMDiff™   

FileMaker Business Alliance
View Jürgen Geßwein's profile on LinkedIn

This site is W3C compliant:
Valid XHTML - Valid CSS
Last modified February 24 2016, 21:22:16 MET.

How To Proceed If a FileMaker File is Suspected of Having Corruption?

What are the signs of corruption?  ^ 

Fortunately most of the times during development you have a suspicion of file corruption, it turns out not to be the case. It was some kind of mis-configuration, wrong field type, wrong relation, wrong context, wrong logic, and the like. But there are cases when the signs are glaring, a file on a server won't open, opening it on a workstation it claims to need recover, etc. So what to do now?

Despite this dialog's recommendation, try a Save as compressed copy first. This rebuilds the file's internal table of contents which might have been out of sync and thus has triggered that message.

The golden rule says: return to your last backup. But more often than not there is no such good backup - and if, it's very very old. Too much data has been entered and too many changes have been applied as this would be an easy decision. So one has to try to save what can be saved.

The Poor Man's Rescue  ^ 

We have Recover built into FileMaker! Let's go for it and we're done? Maybe yes, maybe no, it depends how hard the file was hit. Please note: A file never forgets a Recover, it's kept as an internal entry, and FMDiff shows how many times a file has been recovered.

There were hundreds of pages written about what Recover does, when to use it and when not. Almost everyone has made one's own experiences with Recover, good or bad. FileMaker has given recommendations in the Help file, but nowhere is mentioned a reliable method to test for the presence or absence of file corruption.

How to rewrite a FileMaker file?  ^ 

In case you can't avoid a rewrite, these instructions may help you to get the job done in a short time. Don't try to apply "improvements" or renaming of elements during that process, since this might break things. Take notes and apply your ideas after the job is done.

Prepare Dokumentation
Open the old working file.
Create a DDR (if possible).
Print all scripts (if possible), best to PDF format.


Folder & Files
Create a new Folder.
Create a new file in that folder with the same name.


Custom Functions
Redefine Custom functions (copy & paste calculations).
If these use defined fields, make these a comment and correct them later.


Tables
Go to Define Database in old working file.
Select Tables.
Select all tables and Copy.

Go to Define Database in new file.
Select Tables.
Clean out the existing table there including occurrences.
Paste.

These steps should be easily done. Now run a DDR on the new file and compare it to the list of tables, TOs, fields, and layouts. Under certain circumstances there might be "invisible" elements that don't allow you to create elements of a specific name, claiming it already exists. If you meet one of those in the DDR that's missing in the list, you have to copy the elements of that group one by one. You could also try to recover the old file and copy the elements from there. This depends on how a file was damaged.

External Data Sources (File References)
If the DDR did not work, you may have to go back to an older backup to see
what they were.


Setup the relations.
If the DDR did not work, you may have to go back to an older backup to see
what they were.


Value Lists
Redefine Value Lists (copy & paste content where applicable)


Layouts
Create all additional layouts (blank) with their old names.
Link layouts to the correct TO.

Set the layout order exactly as in the old file.

Create the corresponding layout parts (header, body, summary, etc.) and set 
their heights in pixel exactly as in the old file. (Thanks to Jim S. for
this suggestion.)



Scripts
Go to old working file, open Define Scripts.
Select all Scripts and copy. Paste in new file.

Important: Scripts must be provided exactly after the blank layouts exist,
and before the layout contents is pasted in. This way the scripts find their
layout and the layout buttons find their script. (Thanks to Jeff M. for this
suggestion.)


Layout contents
Loop
    Go to old working file, layout mode.
    Copy one layout (select all)*
    Go to new file, layout mode.
    Paste into the new file.
    Go to next layout in both files (exit after last)
End Loop

* If you don't have any elements that touch the top and left margins,
  note the pixel position to apply in the new file. (Jim S. further suggests
  to generally place a 1 by 1 px transparent object at the top left, to avoid
  the need to adjust the pasted layout to a noted position - it will always
  be at 0, 0 that way.)


Final Check
Make a DDR PDF from the new file.
Search for "missing" to find any open ends.

Visit your script definitions and print all scripts.

Search for comments in calculations and scripts that might have been added
automatically during the transfer because a referenced element was not (yet)
available.

By now most of the work is done. If in doubt, compare to DDR of the old working file or earlier backup or compare to PDF of old file.

If you have any comments or improvements or own experiences on these instructions, please feel free to drop me a mail.


Examples are provided "AS IS" without warranties of any kind. Use at your own risk.

© 2005 - 2015 Winfried Huslik †. © 2017 Jürgen Geßwein. All Rights Reserved. FMDiff and FMVis are trademarks of Jürgen Geßwein, Augsburg, Germany. FileMaker is a trademark of FileMaker Inc., Santa Clara, CA, USA. Other trademarks mentioned are property of their respective owners. This web site has not been authorised, sponsored, or otherwise approved by FileMaker, Inc.