Changing a Runtime Dynamic Property

You can use the changeDynamicProperty method of the Property class to change the name, type, and length of a runtime dynamic property. The method has the following signature.

changeDynamicProperty(propertyName: String;
                      propertyType: Type;
                      length:       Integer;
                      scaleFactor:  Byte) updating;

You can change any or all of the propertyName, propertyType, length, and scaleFactor parameter values. The length parameter is required for Binary, String, and StringUtf8 primitive types. The scaleFactor parameter is required for Decimal primitive types.

The type of a primitive property cannot be changed to a reference, and the reverse.

No reorganization is required when you change the type of a runtime dynamic property. If the actual value of a runtime dynamic property differs from the type of the property definition, the value is converted when the value is retrieved. Dynamic property values are always stored using the type of the property definition when the value is updated.

If you reduce the length of a Binary, String, or StringUtf8 runtime dynamic property, any populated values that are longer than the new length are truncated when the property is fetched. The new length is enforced when a new value is assigned to the property.

You cannot change a runtime dynamic property if the class in which it is defined is being used by another process or there is an instance of this class or any subclass.

If instances of the class or any subclasses exist and the length of a Binary or StringUtf8 dynamic property is the maximum value or greater than 540, the length cannot be reduced to less than 541. If instances of the class or any subclasses exist and the length of a String dynamic property is the maximum value or greater than 539, the length cannot be reduced to less than 540.

You can use the changeExclusiveDynamicProperty method of the Property class to change the name of an exclusive runtime dynamic property; for example, an exclusive collection reference. The method has the following signature.

changeExclusiveDynamicProperty(propertyName: String) updating;

You cannot change runtime dynamic properties through the Class Browser.