GetFieldMaxLength

Description

Returns the maximum length of the field as specified when you create the field using Rational ClearQuest Designer. This value corresponds to the number of bytes allowed in the column. The actual number of characters allowed depends on the database encoding (that is, the character set and character set encoding) and the characters in the field string.

This method is relevant only for fields whose type is SHORT_STRING.

Syntaxe

VBScript

entity.GetFieldMaxLength field_name 

Perl

$entity->GetFieldMaxLength(field_name); 
Identificateur
Description
entity
Objet Entity représentant un enregistrement de données utilisateur. Si vous omettez cette partie de la syntaxe au sein d'un point d'ancrage, l'objet Entity correspondant à l'enregistrement de données en cours est faux (VBScript uniquement).
field_name
A String that identifies a valid field name of the entity. The field must contain a fixed-length string.
Return value
A Long indicating the maximum length of the field. The value is the number of bytes as represented in the database that the field can store.
Remarque : The number of bytes is not the same as the number of characters. The exact number of bytes needed to represent a string is determined by the database vendor code page, and the particular characters that are stored in the field. Different characters may consume different numbers of bytes, and the number of bytes required to store a particular character is dependent on the database vendor code page.

Exemples

VBScript

' Check the maximum length of a string field. 
fieldType = GetFieldType("field1") 
If fieldType = AD_SHORT_STRING Then 
   maxLength = GetFieldMaxLength("field1") 
End If 

Perl

# Check the maximum length of a string field. 

$fieldtype = $entity->GetFieldType("field1");

if ($fieldtype eq $CQPerlExt::CQ_SHORT_STRING)

 {

 $maxlength = $entity->GetFieldMaxLength("field1");

 } 

Commentaires