GetFieldType
Description
Identifies the type of data that can be stored in the specified field.
The EntityDef Object controls what type of data can be stored in each field of an Entity object. Fields can store strings, numbers, timestamps, references, and so on. (See FieldType constants for the complete list.)
You cannot change the type of a field using the API. The field type is determined by the corresponding information in the EntityDef object and must be set by the administrator using Rational® ClearQuest® Designer.
You can use the GetFieldNames method to obtain a list of valid names for the field_name parameter.
Syntax
VBScript
entity.GetFieldType(field_name)
Perl
$entity->GetFieldType(field_name);
- Identifier
- Description
- entity
- An Entity object representing a user data record. Inside a hook, if you omit this part of the syntax, the Entity object corresponding to the current data record is assumed (VBScript only).
- field_name
- A String that identifies a valid field name of entity.
- Return value
- A Long that identifies what type of data can be stored in the named field. The value corresponds to one of the FieldType constants.
Examples
VBScript
set sessionObj = GetSession
' Iterate through the fields and output
' the field name and type.
fieldNameList = GetFieldNames
For Each fieldName in fieldNameList
fieldType = GetFieldType(fieldName)
sessionObj.OutputDebugString "Field name: " & fieldName & _
", type=" & fieldType
Next
Perl
$sessionobj = $entity->GetSession();
# Iterate through the fields and output
# the field name and type.
$fieldnamelist = $entity->GetFieldNames();
foreach $fieldname (@$fieldnamelist)
{
$fieldtype = $entity->GetFieldType($fieldname);
$sessionobj->OutputDebugString("Field name: ".$fieldname. ",
type=".$fieldtype);
}