Specifying the length of attributes in specs

In general, keep the default value for the maximum length of an attribute in a spec, because space is not pre-allocated based on the maximum length. However, there might be some situations when you want to adjust the value of the maximum length.

Note: After you have added an item or category, when providing values for the attributes of that item or category, the string length is actually measured in bytes and not characters which can be multi-bytes. The maximum string length is 5000 or more English one byte characters or 1332 characters.

For example, if you have downstream applications that consume data from InfoSphere® MDM Server for PIM and there are limitations on the maximum size of data in one or more of those applications, you might want to put restrictions on the amount of data that a user can enter by setting a smaller value on the maximum length of the corresponding attribute as defined in InfoSphere MDM Server for PIM. The attribute types that you would likely need to customize the maximum length in this example are Integer, Number, Password, Rich Text and String.

In the table below, "default maximum length" refers to any of the following:
  • The default value that is presented in the spec definition screen.
  • For script operations, it is not necessary to provide a value on the MAXLENGTH attribute. Therefore, you do not need to call Node::setAttribute on the MAXLENGTH attribute.
  • For Java™ API, it is not necessary to provide a value on the MAXLENGTH attribute. Therefore, you do not need to call setValue method on the AttributeDefinitionProperty for the attribute MAXLENGTH.
Table 1. Default maximum length of attributes in a spec
Attribute Type Typical value of maximum length Recommendation
Binary The maximum length allowed for a URL or name of a local file.  
Currency See Validation rules for number, integer and currency attribute types for more information.  
Date (Date only) Any positive number. Keep the default maximum length.
External content reference Any positive integer. Keep the default maximum length.
Flag Set it to be at least 5. Keep the default maximum length.
Image The maximum length allowed for a URL or a name of a local file.  
Image URL The maximum length allowed for a URL.  
Integer See Validation rules for number, integer and currency attribute types for more information.  
Lookup table Any positive integer. Keep the default maximum length.
Number See Validation rules for number, integer and currency attribute types for more information.  
Number enumeration The total number of digits including the decimal separator that can be entered for the attribute. If "Total number of digits" and "Fraction digits" attributes are used, the Maximum Length and Precision attributes are ignored. Keep the default maximum length as the value is selected from a predefined list of number enumerations.
Password The maximum length allowed for the text if "Single Line String" facet is specified. Otherwise control characters are counted in the total length. For example, the line termination control characters (\r\n for carriage return and line feed) are counted as 2 characters.  
Relationship Any positive integer. Keep the default maximum length.
Rich text The maximum length allowed for the rich text (markup tags are counted as characters contributing to the maximum length as well).  
Sequence Any positive integer. Keep the default maximum length.
String The maximum length allowed for the text if "Single Line String" facet is specified. Otherwise control characters are counted in the total length. For example, the line termination control characters (\r\n for carriage return and line feed) are counted as 2 characters.  
String enumeration The maximum length allowed for the text if "Single Line String" facet is specified. Otherwise control characters are counted in the total length. For example, the line termination control characters (\r\n for carriage return and line feed) are counted as 2 characters. Keep the default maximum length as the value is selected from a predefined list of number enumerations.
Thumbnail image The maximum length allowed for a URL or a name of a local file.  
Thumbnail image URL The maximum length allowed for a URL.  
Time zone Set it to be long enough to allow saving the internal string representation of a time zone. Keep the default maximum length.
URL The maximum length allowed for a URL.  

The table above provides limits only on the number of characters a user can enter when editing the attribute. Setting a maximum length on certain attribute types can also imply a limit on the actual value. For example, a maximum length of 2 for an Integer limits the number the user can enter to the range -99 to 99, inclusive. However, the internal representation will never change, whatever the maximum length is set to. For example, even when the maximum length is 2 the value is still held as a 32-bit integer, although a single byte would be sufficient, and if the maximum length is 20 the value is still held as a 32-bit integer, which means that the maximum length in this case does not prevent the user from entering a number that is outside the valid range.