Count

説明

コレクション内のアイテム数を戻します。このプロパティは読み取り専用です。

構文

VBScript

collection.Count 

Perl

$collection->Count(); 
識別子
説明
collection
Attachments コレクション オブジェクト。レコードの 1 つのフィールドの添付ファイルのセットを表します。
戻り値
コレクション オブジェクト内のアイテム数を示す Long。このメソッドは、コレクションにアイテムが含まれていない場合はゼロを戻します。

VBScript

' This example assumes there is at least 1 attachment field
' associated with the record. 
set currentSession = GetSession
set attachFields = AttachmentFields
set attachField1 = attachFields.Item(0)
set theAttachments = attachField1.Attachments
numAttachments = theAttachments.Count
For x = 0 to numAttachments - 1
     set attachment = theAttachments.Item(x)
     ' Do something with the attachments
Next

Perl

#Get a list of attachments
$attachfields = $entity->GetAttachmentFields();

# Get the first attachments field
$attachfield1 = $attachfields->Item(0)

# Get the collection of attachments from the attachments field
$attachments = $attachfield1->GetAttachments();
#Get the number of attachments
numAttachments = $attachments->Count(); 

フィードバック