管理者が、指定されたフィールドのリーガル値を選択リストの内容に制限するかどうかを指定します。制限がある場合、選択リストにない値を指定すると、検証エラーとなります。制限がない場合、選択リストにない値を指定できます。(指定する値は、そのまま検証される必要があります。)
このメソッドで空の Variant が戻される場合、すべての値が許可されることを暗黙しているわけではありません。このフィールドに許可される値に関するヒントを、管理者が設定していなかったことを意味するにすぎません。
管理者がフックを使用して選択リストの値を判別することを選択した場合、IBM Rational ClearQuest は既にフックを実行していて、結果の値を HookChoices オブジェクトにキャッシュしています (Visual Basic のみ)。このオブジェクトを使用して値を取得できます。
フィールドの選択セットを生成する選択リスト フックを使用する場合、フック プロシージャに渡されるコレクションに結果を格納して、結果を戻す必要があります。
GetFieldNames メソッドを使用すると、field_name パラメータの有効な名前のリストを取得できます。
VBScript
entity.GetFieldChoiceList field_name
Perl
$entity->GetFieldChoiceList(field_name);
VBScript
fieldValue = GetFieldValue("field1").GetValue ' Check to see if the field's current value is in the choice list fieldChoiceList = GetFieldChoiceList("field1") For Each fieldChoice in fieldChoiceList If fieldValue = fieldChoice Then ' This is a valid choice End If Next
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]); } #Example 2: sub Dyn_choice_get_values { my $session; my $fieldchoicelist; $session = $entity->GetSession(); $fieldchoicelist = $entity->GetFieldChoiceList("Dyn_List_Example"); $session->OutputDebugString(" CHOICELIST @$fieldchoicelist ¥n"); return 0; }