Delete

설명

콜렉션에서 첨부 파일을 삭제합니다.

VBScript의 경우, 이 메소드에 대한 인수는 숫자 색인(itemNum) 또는 표시 이름(displayName)일 수 있습니다. Perl의 경우, 인수는 숫자 색인이어야 합니다.

이 메소드를 호출하여 CountItem 메소드를 사용하여 올바른 Attachment 오브젝트를 찾을 수 있습니다.

주: Delete를 삭제하려면 Entity가 편집 가능 상태에 있어야 합니다. Rational ClearQuest 후크에서 이 메소드를 사용하는 중에 현재 레코드(즉 현재 조치를 수행 중인 레코드)에서 첨부를 삭제하면, 엔티티는 이미 편집 가능 상태에 있습니다. 그러나 후크에서 이 메소드를 사용하는 중에 현재 엔티티가 아닌 레코드에서 첨부를 삭제하거나 외부 프로그램에서 이 메소드를 사용하는 중이면, 먼저 EditEntity 메소드를 호출하여 엔티티를 편집 가능 상태로 만들어야 합니다. 자세한 정보는 EditEntity 메소드를 참조하십시오.

구문

VBScript

attachments.Delete itemNum 
attachments.Delete displayName 

Perl

$attachments->Delete(itemNum); 
ID
설명
attachments
레코드의 한 필드에 있는 첨부 세트를 나타내는 Attachments 콜렉션 오브젝트
itemNum
VBScript의 경우, 콜렉션에 대한 색인인 Variant 값. 이 색인은 0을 기반으로 하며 삭제할 파일을 가리킵니다. Perl의 경우, 콜렉션에 대한 색인은 Long 값입니다. 이 색인은 0을 기반으로 하며 삭제할 파일을 가리킵니다.
displayName
VBScript의 경우, 콜렉션 내의 항목에 대한 표시 이름인 Variant 값
Return value
파일이 삭제된 경우에는 True, 그렇지 않은 경우에는 False를 리턴하는 부울

예제

VBScript

' This example assumes there is at least 1 attachment field in this record type,
' and at least one attachment associated with this record.
' NOTE: The entity must be in an editable state to delete an attachment -- see above.
set currentSession = GetSession  set attachFields = AttachmentFields 
set attachField1 = attachFields.Item(0) 
set theAttachments = attachField1.Attachments 
If Not theAttachments.Delete(0) Then
    OutputDebugString "Error deleting the attachment."
End If 

Perl

# This example assumes there is at least 1 attachment field in this record type,
#  and at least one attachment associated with this record.
# NOTE: The Entity must be in an editable state to delete an attachment -- see above.
# For this entity record, get the collection of all attachment fields
$attachfields = $entity->GetAttachmentFields();
# Work with the first attachment field
$attachfield1 = $attachfields->Item(0);
# For this attachment field, get the collection of all its attachments
$attachments = $attachfield1->GetAttachments();
# Delete the first attachment
if (!$attachments->Delete(0)) {
    $session->OutputDebugString("Error deleting attachment from record.\n");
}


피드백