GetFieldChoiceType

Descrizione

Restituisce il tipo di elenco selezioni per il campo specifico.

Il valore di ritorno è una costante ChoiceType, CLOSED_CHOICE o OPEN_CHOICE. Se il valore di ritorno è CLOSED_CHOICE, i valori validi per il campo sono limitati a quelli specificati nell'elenco selezioni. Se il valore di ritorno è OPEN_CHOICE, l'utente può selezionare un elemento dal tipo o dall'elenco selezioni in un nuovo valore.

Sintassi

VBScript

entity.GetFieldChoiceType field_name 

Perl

$entity->GetFieldChoiceType(field_name); 
Identificativo
Descrizione
entity
Un oggetto Entity che rappresenta un record di dati dell'utente. All'interno di un hook, se si omette questa parte della sintassi, viene utilizzato l'oggetto Entity corrispondente al record di dati corrente (solo VBScript).
field_name
Una stringa che identifica un nome del campo valido dell'entità.
Valore di ritorno
Un valore Long che indica il tipo di campo. Questo valore è una delle Costanti ChoiceType.

Esempi

VBScript

' If the field must have a value from a closed choice list, assign 
' the first value in the list to the field by default. 
choiceType = GetFieldChoiceType("field1") 
If choiceType = AD_CLOSED_CHOICE Then 
   ' Set the field to the first item in the choice list. 
   fieldChoiceList = GetFieldChoiceList("field1") 
   SetFieldValue "field1", fieldChoiceList(0) 
End If 

Perl

# If the field must have a value from a closed choice list, assign
# the first value in the list to the field by default. 

$choicetype = $entity->GetFieldChoiceType("field1");
if ($choicetype eq $CQPerlExt::CQ_CLOSED_CHOICE)
{
# Set the field to the first item in the choice list. 
$fieldchoicelist = $entity->GetFieldChoiceList("field1");
$entity->SetFieldValue("field1",@$fieldchoicelist[0]);
} 

Feedback