フィールド選択リスト フック例

選択リスト フックを使用して、ユーザーの選択リストをビルドできます。 Rational® ClearQuest® ソフトウェアで選択リスト フックを呼び出す場合、選択パラメータに HookChoices クラスのインスタンスが指定されます。フックでこのオブジェクトを使用して、アイテムをリストに追加するか、または既存のリスト アイテムをソートします。選択リスト内のアイテムをソートしない場合、アイテムはリストに追加された順に表示されます。

次の例では、内容がさまざまなオペレーティング システムの名前である、選択リストをビルドします。

VBScript

Sub OS_type_ChoiceList(fieldname, choices)

    ' fieldname As String
    ' choices As Object
    ' entityDef = defect
    choices.AddItem("Solaris")
    choices.AddItem("Windows")
    choices.AddItem("HP/UX")

End Sub 

Perl

sub OS_type_ChoiceList {

    my($fieldname) = @_;
    my @choices;
    # $fieldname as string scalar
    # @choices as string array
    # entityDef is Defect
    # use array operation to add items. Example:
    # push(@choices, "red", "green", "blue");
    push(@choices, "Solaris", "Windows", "HP/UX");
    return @choices; 

} 

フィードバック