Unreferenced

BaseElements will build a list of all of the places that an item is in used, and when there are no references for any one item it marks them as "Unreferenced" and show this on the "Referenced By" tab.

In list layouts this may appear with the label "U" where there isn't enough room to show the full name.

One exception to Unreferenced is when the item is a Layout that is set to show in the Layouts menu, or a Script set to show in the Scripts menu. In that case the item isn't being referenced directly but may be in use by the user when invoked manually from the menus that display the item.

Indirection

In lots of element types, there is also the possibility that the solution is using Indirection and so the element might be still used, even though it's listed as "Unreferenced".

Indirection in FileMaker is the ability to refer to items "Indirectly". Ordinarily when you build a calculation and use fields or custom functions by name in the calculation, FileMaker links those names to the internal id of the item, and in that way you can close the calculation, change the name of the referenced items, and the calculation will update to match the new names. This ability doesn't exist in many other programming languages and makes life much easier for long term administration of a solution where you can alter items at will and not break your entire solution.

Newer versions of FileMaker have introduced lots of ways of referring to items by their name instead of via this internal ID, and so there now exists the ability to change a name of something and break a calculation. For example you can use GetField ( "TextFieldName" ) and if you change the name of the field from "TextFieldName" to "ChangedField", without updating all of the places you're using this in calculations, your code will no longer work.

As well as that your calculations can be completely dynamic, and build the fieldname from user data. So GetField ( "Text" & $Variable ) is an equally valid calculation, and the variable data may come from a text field or dialog that the user selects.

BaseElements builds it's list of Indirection functions from any function call that allows you to select a Layout, Field, or Value List or any function where you can include entire calculations that may also refer to Custom Functions.

How this works in BaseElements

BaseElements doesn't try to distinguish between the simple cases such as GetField ( "TextFieldName" ) where it's quite obvious to the user what the field is, and more complex cases such as GetField ( "Text" & $Variable ) where the resulting field(s) may be unknown to the user. The reason for this is that there are just too many possibilities with the complex options for us to decide which items are being referred to at run time. We could build in a simple case solution that found some of these, but we've taken the decision that we'd prefer not to have a solution that only works half the time and where you would never be sure which half it was being accurate with.

Instead of trying to parse out individual item references, BaseElements keeps track of which items may be using indirection and of what type and lets you make decisions about how this will affect your solution.

How to use this in my solution

Firstly, to make your life easier, use Indirection sparingly. In the later versions of FileMaker you even have options like GetFieldName which allow you to use the item directly and also refer to it by name, so your reference counts will still be included. The ability to Indirectly refer to things is powerful and steps like SetFieldbyName can reduce complexity on a massive scale. Use Indirection where needed and keep track of the sorts of things you're using it for. You can also use naming conventions to mark the items that are being used Indirectly as a warning to not delete or rename them.

Secondly be aware of the Unreferenced and Indirection checkboxes and don't delete items without being aware of where they may also be used. Don't delete Fields or Custom Functions in a solution when there are calculation errors, and always test your solution before going live after you've deleted items.

Unreferenced isn't the same as "Safe to Delete"

The Unreferenced checkbox is a very useful tool for cleaning up a solution that has lots of items that are no longer being used. But be aware that there are lots of places that items can be used outside of the list of possible references, as well as reasons why the reference count is incomplete. Firstly the ability to use Indirection restricts what references are generated for any item, and so that limits your access. As well other options for accessing the data inside FMP from outside ( things like ODBC or PHP ) mean there are lots of external ways to access FileMaker data.

Also be aware that any errors in calculations can affect the reference count for that calculation. When the calculation has errors, FileMaker doesn't generate any references at all. So any other items used in that calculation won't have accurate reference counts.

 
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.