2 Replies Latest reply on Oct 21, 2011 8:32 AM by philmodjunk

    What happens if you change a field name



      What happens if you change a field name


       I have a FM 11 database and I want to change the field name of a few fields. If these are used in calculations or criteria for other fields, will they automatically update? What about any scripts that set the field etc? Are there any other risks in changing a fied name I should consider?



        • 1. Re: What happens if you change a field name

          I would save a backup copy of the file before doing that.  If you have Advanced you could do a Database report and see all of the instances where the field in question is used so that you can check to make sure everything updated.

          My experience has been that scripts and relationships do update, but calculations based on those fields may give you some problems.

          • 2. Re: What happens if you change a field name

            98% of the time, you can just change the field name and all will be fine. There are just a few places where you might have referred to a field's name as literal text (name is listed in quotes) where you'll need to find and update the calculation (in a field, script step, script parameter or conditional format)


            Set Field [Table::Field ; Table::field + 1]

            will not need to be updated.

            Set Field [ Table::Field ; Getfield ("Table::field" ) + 1]

            Will need to be updated as the text in quotes will not change when you change the field name.

            This isn't a realistic example, however, as you should use the first form of this expression instead of the second, but you might put "table::Field" in a script parameter so that you can use the same script with different fields and/or layouts by using this script step:

            Set Field by Name [ get ( ScriptParameter ) ; GetField ( Get ( Scriptparameter ) ) + 1 ]

            Thus, you would look for any places where you might have used set field by name or get field and listed the field's name in quotes either in the expression or in a script parameter or variable that is then used in such an expression.

            Get ( ActiveFieldName ) = "Field"

            would be another case. Anyone think of another one?

            Experienced Developers try to avoid using a field's name in quotes like this so that they do not introduce this potential issue into their database. In many cases, you can pass the field's name in a script parameter by using getFieldName ( Table::Field ) and this will then update automatically should you choose to change the field's name.

            Also keep in mind that except for table views, you can modify the layout text to name a field on that layout any way you want, so you may choose to just edit the layout text used to label it on your layouts instead of changing the actual field name.