How do I search for unreferenced Relationships?

Background

In versions of FileMaker prior to v7, you had one list of "Relationships" for each file and this represented both the end point of the relationship as well as the field being used as a match field. v7 changed all of that where you have a graph, and it now has Table Occurrences ( TOs ) as well as Relationships to join them. But a single TO may be connected to one other TO, or to none, or to 100. So the same concepts no longer apply.

Imagine a simple graph where you have 3 tables, A, B and C. They're joined together in that same order by 2 relationships A-B-C.

How do you tell which Relationships are being used? Imagine you have a layout for each one, and that you have a script that references a field in C. If the script is called from a layout that uses C as it's base table, then none of the relationships are used. If the script is called from a layout using B, then the B-C relationship is being used, but the other A-B relationship isn't. And if it's being called from a layout based on A, then both Relationships are used and required.

However scripting is also not that simple any more. Imagine that the script is called from a layout based on A, but does a Go To Layout based on a calculation passed as a script parameter. Which layout does it go to? And so, which Relationships does it use?

The short answer is that there is no way of knowing.

The main difference is that all of the functionality now in v7 and later refers to TOs and not relationships. You no longer know what path a reference to an end point like TOname::Field will use, just that TOname is the end point. And so given a layout based on A and a calculation that references C, you can only assume that it's possible for both Relationships to be used at some point.

So, when are TOs Unreferenced?

If you know, in the example above, that A is not used for any layouts, and not used in any calculations or other steps, then A can be deleted. It's not used anywhere.

However, if B has no layouts and is not referenced anywhere but both A and C are, then you don't know if B is used or not. Again it depends on what context the references to A and C are used, and where and how.

The short answer is that any TO is unreferenced only if there are no explicit references to it, AND it's the end point of a graph. A TO is on the end point of a graph if it only has one or no relationships to it.

Deleting unused Relationships

You can only then remove a Relationship by removing a TO that has relationships to it. So instead of thinking in terms of Relationships, think in terms of TOs and work from there.

Still need help? Contact Us Contact Us