Modify Attribute

After an attribute is defined, you can change the definition with the Modify Attribute command.

This page discusses:

Syntax

This command lets you add or remove defining clauses and change the value of clause arguments:

modify attribute NAME [MOD_ITEM {MOD_ITEM}];
  • NAME is the name of the attribute you want to modify.
  • MOD_ITEM is the type of modification you want to make.

You cannot alter the Type clause. If you must change the attribute type, delete the attribute and add it again using a new Type clause.

Modify Attribute Clauses

You can make the following modifications to an existing attribute definition. Each is specified in a Modify Attribute clause, as listed in the following table. You only need to specify the fields to be modified.

Modify Attribute Clause Description
name NAME 
The current attribute name changes to the new name entered.
default VALUE 
The current default value, if any, is set to the value entered.
!hasdefault
The current default value, if any, is removed and the attribute is defined to have no default value.

You can modify an attribute that has a default value and change it to an attribute without a default value using the following command.

mod attribute AttributeName !hasdefault;

However, if you have defined !hasdefault for an attribute, you cannot modify it to have a default attribute.
description VALUE 
The current description value, if any, is set to the value entered.
icon FILENAME
The image is changed to the new image in the file specified.
dimension DIMENSION_NAME 
Adds an existing dimension DIMENSION_NAME to an integer or real attribute.

When adding dimensions to attributes that already belong to business object instantiations, see Applying a Dimension to an Existing Attribute.

icon FILENAME 
The image is changed to the new image in the file specified.
owner ADMIN 
Changes the attribute owner to the specified ADMIN object.
[!|not]multivalue 
Changes the attribute to be multivalue or not. Only existing singlevalue attributes can be modified to become multivalue . If the attribute is already a rangevalue, an error will be thrown.

For more information, see MQL Concepts: Multi-Value and Range-Value Attributes.

[!|not]rangevalue 
Changes the attribute to specify a range values or not.

For more information, see MQL Concepts: Multi-Value and Range-Value Attributes.

[!|not]hidden 
Changes the option to specify that the object is hidden, or when using the prefix ! or not, the object is not hidden.
[!|not]resetonclone 
Resets the attribute value to its default value in new business object and connection clones, or when using the prefix ! or not, the current attribute value is retained in new business object and connection clones.
[!|not]resetonminorrevision 
Resets the attribute value to its default value in new business object and connection revisions, or when using the prefix ! or not, the current attribute value is retained in new business object and connection revisions.
maxlength VALUE 
The maximum number of characters the attribute's value can contain. If you modify the maximum length definition for an attribute to a number less than the current number, existing attributes will be maintained with their longer values and new attributes will need to follow the new maximum length.

If the attribute is part of an enabled index or uniquekey definition, you must disable the index or umiquekey, modify the maxlength, then re-enable the index or uniquekey.

add |dimension DIMENSION_NAME               |
    |range RANGE_ITEM                       |
    |TRIGGER PROG_NAME                      |
    |rule NAME                              |
    |property NAME [value STRING]           |
    |property NAME to ADMIN [value STRING} |

where RANGE_ITEM is one of:

|| = | != | < | > | <= | >= | VALUE        |
|| smatch|!smatch|match|!match | PATTERN   |
| between VALUE|inclusive|VALUE|inclusive| |
               |exclusive|     |exclusive| |
| program PROG_NAME [input ARG_STRING]     |

where TRIGGER is:

trigger EVENT_TYPE | action    |
                   | check     |
                   | override  | 

where EVENT_TYPE is:

           | modify    |

where ADMIN is:

           | TYPE_NAME | 
Adds the named dimension to an integer or real attribute.

Adds the specified Range clause to the existing list of Range clauses. This Range clause must obey the same construction and syntax rules as when defining an attribute.

Changes the trigger program to PROG_NAME. TRIGGER is the type of trigger program (action, check, or override) and PROG_NAME is the name of the program that replaces the current trigger program. "modify" is the only supported trigger event for attributes.

Adds the named access rule.

Adds the named property.

Adds the named property to the specified administrative object.

remove | dimension DIMENSION_NAME |
        | range RANGE_ITEM         |
        | TRIGGER                  |
        | rule NAME                |
        | keepformat               |
        | format                   |
        | property NAME            |
        | property NAME to ADMIN   | 
Removes the dimension DIMENSION_NAME from an integer or real attribute.

Removes the specified Range clause from the existing list of Range clauses. The given Range clause must exist, or an error message is displayed.

The specified trigger program is removed. PROG_TYPE is the type of trigger program (check, override, or action).

Removes the named access rule.

Removes the named property.

Removes the named property from the specified administrative object.

history STRING 
Adds a history record marked "custom" to the attribute that is being modified. The STRING argument is a free-text string that allows you to enter some information describing the nature of the modification. For more information, see Adding History to Administrative Objects.

Each modification clause is related to the clauses and arguments that define the attribute. For example, you would use the Default clause of the Modify Attribute command to modify the Default clause that you used in the Add Attribute command.

Assume you have the following attribute definition:

attribute Units
   description "Measuring units"
   type string
   default "Linear Feet"
   range = Quarts
   range = "Linear Feet";

Now you have decided to use the attribute for measuring distances only. While it might be faster to define a new attribute, you could modify this attribute with the following command:

modify attribute Units
   description "Units for Measuring Distances"
   remove range = Quarts
   add range = "Linear Yards";

After this command is processed, the attribute definition for the Units attribute is:

attribute Units
   description "Units for Measuring Distances"
   type string
   default "Linear Feet"
   range = "Linear Feet"
   range = "Linear Yards";