GetFieldChoiceType

Descripción

Devuelve el tipo de lista de opciones para el campo determinado.

El valor de retorno es una constante ChoiceType, CLOSED_CHOICE u OPEN_CHOICE. Si el valor de retorno es CLOSED_CHOICE, los valores válidos para el campo se limitan a los que se han especificado en la lista de opciones. Si el valor de retorno es OPEN_CHOICE, el usuario puede seleccionar un elemento de la lista de opciones, o bien, escribir un nuevo valor.

Sintaxis

VBScript

entity.GetFieldChoiceType field_name 

Perl

$entity->GetFieldChoiceType(field_name); 
Identificador
Descripción
entity
Un objeto Entity que representa un registro de datos de usuario. En un enganche, si se omite esta parte de la sintaxis, se presupone el objeto Entity correspondiente al registro de datos actual (sólo VBScript).
field_name
Un valor String que identifica un nombre de campo válido de entidad.
Valor de retorno
Un valor Long que indica el tipo de campo. Este valor es una de las constantes de ChoiceType.

Ejemplos

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