Convert Attribute

The convert attribute command converts the units defined for the attribute. The convert command requires system administrator privileges.

This page discusses:

Syntax

convert attribute NAME to unit UNITNAME [commit N] [output FILENAME] searchcriteria SEARCHCRITERIA

  • If the searchcriteria contains instances that have already been converted to:

    • The unit specified in the search criteria, then no conversion is done.
    • A different unit than specified in the search criteria then the conversion is done and the input unit is updated to UNITNAME.
  • commit N controls how many objects or connections are processed before committing the transaction.
  • output logs information to the specified FILENAME.

This command also makes an entry to the object’s history. Triggers are disabled during the command execution.

To convert stored values to the default units:

  1. Log into MQL as an administrative user.
  2. Apply the dimension to the attribute.
  3. Enter Y.

Applying a Dimension to an Existing Attribute

You can add a dimension to attributes of type integer or real, whether or not the attributes already belong to instantiated business objects. The existing value stored for that attribute will be treated as the normalized value.

However, if the existing value is a unit other than what the dimension uses as its default, you need to convert those values. For example, an existing attribute Length has stored values where the business process required the length in inches. You want to add a Length dimension to the Length attribute, and that dimension uses centimeters as the default. If you just add the dimension to the attribute, the existing values will be considered as centimeters without any conversions.

As another example, the Length attribute can be used with multiple types. Some types could use the attribute to store lengths in millimeters, while others store lengths in meters. Because there is only one attribute Length that represents two kinds of data, the dimension cannot be applied without normalizing the business types on the same unit.

Use the convert attribute command to convert the attribute to 1 unit of measure.

mod attribute ATTRIBUTE_NAME dimension DIMENSION_NAME;

Replace ATTRIBUTE_NAME with the attribute name and DIMENSION_NAME with the dimension name.

To specify the existing units of the attribute:

convert attribute ATTRIBUTE_NAME to unit UNIT_NAME on temp query bus “TYPE” * *;

This command applies the unit UNIT_NAME to the attribute, which causes the conversion from the existing value with the applied units to normalized values.

The system displays this message:

Convert commands will perform mass edits of attribute values. 
You should consult with MatrixOne support to ensure you follow appropriate procedures for using this command. 
Proceed with convert (Y/N)?

If the system message includes the following warning, the data for this attribute has already been converted and you should not continue (type N).

WARNING: The search criteria given in the convert command includes objects that 
currently have unit data. This convert command will overwrite that data.

Changing the Default (Normalized) Units of a Dimension

The Weight attribute includes a dimension containing units of measure with the default units set to grams. If your company uses the Weight attribute representing a different unit, you have these options:

After applying a dimension, you can only change the default units of measure before any user enters any data for the attribute. After values are stored in the asentered field, you cannot change the default units of measure.

To change a dimension’s default units, see Changing the Default (Normalized) Units of a Dimension.