GetFieldDefType

Descrizione

Identifica il tipo di dati che è possibile memorizzare nel campo specificato.

È possibile utilizzare il metodo GetFieldDefNames per ottenere un elenco di nomi di campo validi.

Il tipo di record controlla il tipo di dati che è possibile memorizzare in ciascun campo di un record di dati corrispondente. Nei campi possono essere memorizzati stringhe, numeri, date/ore, riferimenti e così via. (Per l'elenco completo, consultare l'argomento Costanti FieldType).

Come per le altre parti di un oggetto EntityDef, l'amministratore imposta i campi definiti utilizzando Rational ClearQuest Designer. Tali stati non possono essere impostati direttamente dall'API.

Sintassi

VBScript

entitydef.GetFieldDefType field_def_name 

Perl

$entitydef->GetFieldDefType(field_def_name); 
Identificativo
Descrizione
entitydef
Un oggetto EntityDef corrispondente ad un tipo di record in uno schema.
field_def_name
Una stringa che identifica un nome di campo valido dell'oggetto entitydef.
Valore di ritorno
Un valore Long che specifica il tipo di dati che è possibile memorizzare nel campo denominato. Il valore corrisponde a una delle costanti FieldType.

Esempi

VBScript

set sessionObj = GetSession
set entityDefObj = sessionObj.GetEntityDef(GetEntityDefName())

sessionObj.OutputDebugString "Integer fields of " & _
            entityDefObj.GetName()

' List the field names in the record that contain integers
nameList = entityDefObj.GetFieldDefNames()
For Each fieldName in nameList
   fieldType = entityDefObj.GetFieldDefType(fieldName)
   if fieldType = AD_INT Then
      sessionObj.OutputDebugString fieldName
   End If
Next 

Perl

$sessionObj = $entity->GetSession();

$entityDefObj =
      $sessionObj->GetEntityDef($entity->GetEntityDefName());



$sessionObj->OutputDebugString("Integer fields of ".$entityDefObj.GetName());



# List the field names in the record that contain integers

$nameList = $entityDefObj->GetFieldDefNames();



foreach $fieldName (@$nameList)
   {
 $fieldType = $entityDefObj->GetFieldDefType($fieldName);

 if ($fieldType eq $CQPerlExt::CQ_INT)

  {

  $sessionObj->OutputDebugString($fieldName);

  }

 } 

Feedback