Using attributes of String type





This article describes the standards that apply to String attributes. All of the listed recommendations are mandatory unless noted otherwise.

1.1. For String attributes, specify Variable length type in the Allowed Length property, and specify the maximum string length. Avoid using Fixed length type unless absolutely necessary (fixed length can be maintained by adding spaces to the end of the string). 

1.2. If the maximum string length is predefined (in standards, regulatory documents, and so on), specify it in the Length property, or in the Description length property of the standard Description attribute. For example, the length of the SSN attribute of the Employees catalog must be 9 characters.

1.3. Calculate the length of a concatenated string by summing up lengths of all its segments. For example, calculate the length of address presentation by adding lengths of address lines.

1.4 If a string length is not regulated by any standards, set the length that is sufficient for storing data in most cases. For example, a full contractor name usually takes up to 250 characters, a file name in most file systems takes up to 260 characters, a full name of an individual takes up to 100 characters, and so on.

2. Using strings with undefined length is allowed in the following cases:

2.1. A string attribute is intended for storing user-defined text that might be of significant length. A common example is a form field that allows input of multiple text lines. For example, a manager can store the entire customer communication history in the Additional info field of a customer order; a user can store an arbitrary text that contains multiple lines in the Comment field, and so on.

2.2. A string attribute stores application-generated technical data, which is mostly not intended for viewing by users but intended for using in data processing algorithms. For example, XML documents or email message headers.

3. When using strings with undefined length, remember the following query language limitations:

3.1 When comparing, grouping, or selecting distinct values you must convert them to fixed length strings. Otherwise, the calculation result might be incorrect.

We recommend that you use the following query syntax:

CAST AS STRING(1000)

3.2. In data composition schema-based reports, specify the Value Type parameter for such fields (on the Data Sets tab).

Note that frequent conversion of undefined length to fixed length in queries and data composition schema-based reports might indicate that the application design is not optimal. If this is the case, redesigning in favor of fixed length is recommended.

3.3. In all other cases you can freely use strings with undefined length in queries.

4.1. If a string is displayed in a print form field, ensure that it is never cut, regardless of the declared string length. Cutting a string might lead to a loss of significant data, such as building and apartment numbers in a delivery address.


Comments
0
Add comment