GetFieldChoiceType

説明

指定されたフィールドの選択リスト タイプを戻します。

戻り値は、CLOSED_CHOICE または OPEN_CHOICE のいずれかの、ChoiceType 定数です。戻り値が CLOSED_CHOICE の場合、フィールドに有効な値は、選択リストに指定された値に限定されます。戻り値が OPEN_CHOICE の場合、ユーザーは選択リストからアイテムを選択するか、または新規の値を入力できます。

構文

VBScript

entity.GetFieldChoiceType field_name 

Perl

$entity->GetFieldChoiceType(field_name); 
識別子
説明
entity
Entity オブジェクトは、ユーザー データ レコードを表します。構文のこの部分を省略すると、フック内では、現在のデータ レコードに対応する Entity オブジェクトが想定されます (VBScript のみ)。
field_name
Entity の有効なフィールド名を識別する String。
戻り値
フィールドのタイプを示す Long。この値は、ChoiceType 定数の 1 つです。

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

フィードバック