ユーザーがレコードを作成すると、Rational® ClearQuest® ソフトウェアは、レコードを作成して、そのフィールドを適切なデフォルト値に初期化します。特定のフィールドに、それに関連するデフォルト値フックがある場合は、そのフックが実行されてフィールド値が設定されます。フックがフィールドに関連付けられていない場合は、そのフィールド タイプに合ったデフォルト値が割り当てられます。 例えば、整数フィールドは 0 に設定され、文字列フィールドは空の文字列に設定され、リスト フィールドは空のリストに設定されます。 日付フィールドは、デフォルト値には初期化されません。日付フィールドには、常にデフォルト値フックを指定してください。
Sub submit_date_DefaultValue(fieldname) ' fieldname As String ' entityDef = defect call SetFieldValue(fieldname, now) End Sub
# Define a function for the current timestamp sub GetCurrentDate { my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $time) = localtime(); return sprintf("%4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec); } # Define a routine to call the timestamp function sub Submit_Date_DefaultValue { my($fieldname) = @_; # $fieldname as a string scalar and entityDef is Defect $entity->SetFieldValue($fieldname, GetCurrentDate()); }
Sub submitter_DefaultValue(fieldname) ' fieldname As String ' entityDef = swbug SetFieldValue fieldname, GetSession().GetUserLoginName() End Sub
sub Submitter_DefaultValue { my($fieldname) = @_; # $fieldname as a string scalar # entityDef is Defect my $session; my $username; $session = $entity->GetSession(); $username = $session->GetUserLoginName(); $entity->SetFieldValue($fieldname, $username); }