1 Reply Latest reply on Mar 14, 2011 11:04 AM by philmodjunk

    Naming Fields



      Naming Fields


      Although I am quite a way through the development of my project, I have decided to have to change a few things using methods/techniques and improvements that I have picked up during the lifespan of this project - I started as a total newbie to FM.

      Some of these amendments concern the initial structure of tables and whilst I am dealing with this, I am considering changing the syntax of my field names. As I have developed in other languages previously, I have stuck to my roots and used methodologies such as camel case etc.

      During development I found it particularly tedious that if I was to parameterise a script, at times I would have to pass through the field name and also it's 'real world name' in instances where dialogs have to be displayed.

      Can anybody see any issues with changing a field name from say 'FName' to 'First Name'? This is so I can re-use a script that displays a dialog using say Get(ActiveFieldName). Thus, without having to pass a seperate parameter and the output would be eliligable English.

      I read somewhere when I started this project that no spaces should be used in field names allowing better compatability with other data sources e.g sql.  

      Could field names not be mapped from one source to another? Can anybody see any potential shortcomings?

      Any input would be appreciated,


        • 1. Re: Naming Fields

          In most parts of FileMaker, you can open Manage | Database | Fields, find the field and change it's name and it's reference in other areas such as calculation fields, scripts and layouts will update automatically.  The exceptions to this are where you have exprssions such as SetFieldByName where you refer to the field in literal quotes. If you change a field name, Get (ActiveFieldName) will automatically return the new field name, so that may work for you or not depending on what you do with that field name in the rest of your expression.

          One trick when passing a field name in a script parameter is to use GetFieldName instead of putting the actual field name in quotes. If your field is named "FirstName", you'd put GetFieldName ( Table::FirstName ) instead of "FirstName" as your parameter. Then changing the field name in Manage | Database doesn't require an update of your script parameter expression.

          If you have used setFieldByName or other such expressions where you've identified field names with literal text, you might want to use FileMaker Advanced to generate a database design report that you can the search for instances of a given field name to make sure that you don't miss one that should be updated when you change the field name.