Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim column As NotesViewColumn
Set db = session.CurrentDatabase
Set view = db.GetView( "By Author" )
Set column = view.Columns( 0 )
If column.IsSorted Then
Messagebox( "The first column is sorted." )
Else
Messagebox( "The first column is unsorted." )
End If
End Sub
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vc As NotesViewColumn
Set db = session.CurrentDatabase
Set view = db.GetView("View A")
Set vc = view.Columns(0)
vc.IsSorted = NOT vc.IsSorted
End Sub
スクリプトは doc.ColumnValues(0) = "Blowfish" となる文書は検索していません。この理由は、ビューの第 1 列が、ソートされ分類されている 第 1 列と一致するとは限らないからです。このため、スクリプトは IsSorted プロパティを使用してソートされ分類されている第 1 列を検索し、column.Position - 1 を使用して正しい列の値を取得します。
Sub Initialize
Dim db As New NotesDatabase( "", "ocean.nsf" )
Dim view As NotesView
Dim column As NotesViewColumn
Dim doc As NotesDocument
Dim done As Variant
Set view = db.GetView( "By Category" )
' get the first sorted and categorized column in the view
Forall c In view.Columns
If ( c.IsSorted And c.IsCategory ) Then
Set column = c
Exit Forall
End If
End Forall
' get the first document that matches the key
Set doc = view.GetDocumentByKey( "Blowfish" )
' get the remaining documents that match the key
' since ColumnValues array starts at 0 for position 1,
' subtract 1 from the column position
While ( doc.ColumnValues( column.Position - 1 ) _
= "Blowfish" )
Call doc.PutInFolder( "Fishy" )
Set doc = view.GetNextDocument( doc )
Wend
End Sub