GetFieldChoiceType

설명

제공된 필드의 선택사항 목록 유형을 리턴합니다.

리턴값은 ChoiceType 상수(CLOSED_CHOICE 또는 OPEN_CHOICE)입니다. 리턴값이 CLOSED_CHOICE이면, 필드에 올바른 값이 선택사항 목록에 지정된 값으로 제한됨을 의미합니다. 리턴값이 OPEN_CHOICE이면, 선택사항 목록에서 항목을 선택할 수도 있고 새 값을 입력할 수도 있습니다.

구문

VBScript

entity.GetFieldChoiceType field_name 

Perl

$entity->GetFieldChoiceType(field_name); 
ID
설명
entity
사용자 데이터 레코드를 나타내는 Entity 오브젝트. 후크 내에서 구문에 이 부분을 생략할 경우, Entity 오브젝트가 현재 데이터 레코드에 해당한다고 가정합니다(VBScript에만 해당).
field_name
엔티티의 올바른 필드 이름을 식별하는 문자열.
Return value
필드 유형을 표시하는 Long 값. 이 값은 ChoiceType 상수 중 하나입니다.

예제

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]);
} 

피드백