Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development

> ## Changing the Object type

> If you want to change the Object type of the Objects, select the Change Object Type option and enter the target Object type in the To Object Type Code field or use the lookup button. You can change the Object type to any other type either above or below the current Object type in the Object type hierarchy. If you want to change the Object type to a type somewhere else in the hierarchy, for example, to an Object type that is a sibling parallel to the current Object type, then you must first move the Objects up the hierarchy to a common ancestor and then back down the hierarchy to the proper location.

> Caution: It is very important that you do not arbitrarily assign new Object types to Objects without considering the effects of this change. Changing the Object type could render some of the attributes useless if the Object type it is being changed to does not have those attributes. Generally, it only makes sense to change an Object type to another closely related type, typically to change Objects to an immediate new subtype or from a subtype back to a standard type.

> In considering the relationship between Object types, use the tree view representation in the Class Maintenance tool tree view. This is the definition of the hierarchy that matters when changing Object types because this reflects the actual representation of Object types in the Repository.

> The following sections provide information about:

> - Changing the object type of a set of objects

> - SCM integration considerations

> - Removing redundant attribute values

> - Removing invalid attribute values

> - Processing the changes

> ##### Changing the object type of a set of objects

> If you extend a class at the bottom of the hierarchy, you might want to change the object type of a whole set of objects at one time. For example, you might define a new subclass of a standard object type such as DynView and then move either all of your objects or a subset of the object type that require the extended behavior to the new class. Also, if you previously extended a class to provide behavior that is now part of the standard object, you can return your objects to the standard type.

> You can move objects to a new type using a utility available from the Class Maintenance tool. In this tool, select Class Options Object Type Change Utility.

> To operate on a set of objects, enter their object type in the From Object Type Code field or use the lookup button to select an Object type.

> You can also select a Product Module to filter objects on that basis.

> After you select one or both of these values, choose the Refresh button to display a list of all objects that match your selected values.

> The utility allows you to change Object types and to make other changes to the objects you select. If you want your changes to apply to all the Objects in the browse, select the Process All Objects In Browser option. If you want to further subset the Objects, then select Process Selected Objects and use the browse to select the specific Objects you want.

> Note: If you do not select Process Selected Objects, then selecting individual rows in the browse has no effect.

> After you identify a set of Objects, see the "Changing the Object type" section for a description of how you can modify objects.

> ##### SCM integration considerations

> When extending a class at the bottom of a hierarchy and changing the object types of objects, there are certain SCM implications that you must consider. The new Object Type has to be registered in the SCM Object Type Xref control, which is accessible from the SCM menu option on the Dynamics Development window. Any required Roundtable subtype change also must be taken into consideration.

> ##### Removing redundant attribute values

> You can do more than just change Object types using the Object Type Change utility. You can also use it to clean up the attribute values in the Repository. Attribute value records are normally stored only at the highest level at which they have a distinct value. For each Object attribute, an attribute value record with the type’s default value is stored at the level of the class. If that value is not changed in a master Object created from the type, then no attribute value record is stored with the master.

> Also, if an attribute for an instance of that master (a Viewer in a particular window, for example) does not have a distinct value for an attribute, then no record is stored at that level. Over time, when moving Objects from one type to another, you might have redundant or invalid attribute value records in the Repository as part of your Object definitions. Redundant attribute value records are those that have a value identical to the default value for Object type. If you have redundant attribute value records, you can improve the performance of your application and reduce the size of the Repository data by removing these records.

> You can also improve the maintenance of the class attribute when you want to modify the value. To do this, select the Remove Attributes That Match Object Type Defaults option. If the Change Object Type option is also selected, the attribute values for all the Objects in your list that match the default attribute values of the Object type you are changing to are removed. If you just want to remove these attribute values without changing the Object type, then uncheck the Change Object Type option. Then only the attribute values for the object that match the default attribute values of its current Object type are removed.

> ##### Removing invalid attribute values

> When you change Objects from one type to another, you might then have attribute values for attributes that are no longer part of the class. These attributes are not retrieved by the run-time API and can be removed. However, you can leave them for informational purposes. To remove the attribute values, select the Remove Attributes That Are Not Part of the Class option. If you are changing the Object type at the same time, this removes attribute values for each Object that is not for attributes of the new Object type. If you are not changing the type, values that are not for attributes for its current Object type are removed. This is usually the result of an earlier change of Object type or some other data conversion. By default, all these options are selected, and as you move Objects from one type to another, both redundant and invalid attribute value records are removed simultaneously.

> ##### Processing the changes

> Before you use the Change Object Type utility, make sure you have a current backup of your Repository database. After you chose a list of Objects and select the change and remove options you want, choose the Process button. The utility displays a confirmation message describing the changes it is about to make, and prompts you to continue. Select Yes to continue.

> If errors occur during processing, an error message appears, processing stops, and any processing that had been done is rolled back. Whether the processing succeeds or is aborted because of an error, a log file named `OTC.log` is written to the working directory. This file displays the options that were selected and lists the objects that were processed. If an error occurred, the error message is written to the log file. If you run the utility multiple times, information and messages are appended to the log file. You should clear the log file for better performance.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095