作成日が 2 つの日付 (開始日と終了日) の間にあるすべてのドキュメントを取得しようとしています。
時々日付にバグがあります。最後のカテゴリが 15/01/2015 の場合、開始日または/および終了日を 15/01/2015 にすると、「オブジェクト変数が設定されていません」というメッセージが表示されます。理解できない。
すべてのドキュメントにビューがあります。これは分類されたビューです。このビューを notesviewnavigator で確認したいと思います。
ドキュメントの作成日が開始日または最終日と同じか、その間にある場合、このドキュメントを最終コレクションに入れます。私のプログラムの最後に、すべてをフォルダーに入れ、ビューを表示します。
これは私のコードです:
Function RechercheDocParDate(dateDebut As String, dateFin As String, nomFolder1 As String, nomFolder2 As String, nomFolder3 As String, nomVue As String, numColonne As Integer) As Integer
' recherche les documents d'une vue en fonction de dates passées en paramètre pour les créer dans un folder privé
Dim vueRech As NotesView
Dim j As Integer
Dim collecEntryFinal As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim colonDate As String
Dim nbDocTrouve As Integer
Dim flag As Boolean
Dim nav As NotesViewNavigator
Dim dbb As NotesDatabase
Dim Session As New NotesSession
Set dbb = session.CurrentDatabase
' Récupération des données de la vue
Set vueRech = dbb.GetView(nomVue)
Call vueRech.Refresh
nbDocTrouve = 0
' a revoir : initialisation de la création d'entry
' création d'une collection d'entry (moins consommateur car le document n'est pas ouvert)
Set collecEntryFinal = vueRech.GetAllEntriesByKey("_gdfgdfg")
j = 1
flag = True
' création d'un navigateur de catégorie d'entry
Set nav = vueRech.CreateViewNav
Set entry = nav.GetFirst
' si on n'est pas rendu à la fin de la vue (penser aux hors catégories)
While ( (Not (entry Is Nothing) ) And ( flag = True ) )
' si c'est bien une categorie
If entry.IsCategory Then
'récupère la colonne de date
colonDate = entry.ColumnValues(numColonne)
If ( colonDate >= dateDebut ) Then
If ( colonDate > dateFin ) Then
flag = False
Else
Set entry = nav.GetNext(entry)
's'il y a des documents
While ( (Not (entry Is Nothing) ) And (entry.IsDocument) )
'recupere les documents de la catégorie
Call collecEntryFinal.AddEntry(entry)
nbDocTrouve = nbDocTrouve + 1
Set entry = nav.GetNext(entry)
'//ALERT
' it finds the documents but in the end of the list of document it crashes here
'//ALERT
Wend
Set entry = nav.GetPrev(entry)
End If
End If
Else
'recupere les documents hors catégorie
While ( (Not (entry Is Nothing) ) And (entry.IsDocument) )
Call collecEntryFinal.AddEntry(entry)
nbDocTrouve = nbDocTrouve + 1
Set entry = nav.GetNext(entry)
Wend
End If
Set entry = nav.GetNextCategory(entry)
Wend
'on crée le dossier privé pour l'utilisateur
'si on trouve des résultats ils sont ajoutés dans le folder
If Not Isempty(collecEntryFinal) Then
If nomFolder1 <> "" Then
collecEntryFinal.PutAllInFolder(nomFolder1)
End If
If nomFolder2 <> "" Then
collecEntryFinal.PutAllInFolder(nomFolder2)
End If
If nomFolder3 <> "" Then
collecEntryFinal.PutAllInFolder(nomFolder3)
End If
End If
Call vueRech.Refresh
RechercheDocParDate = nbDocTrouve
End Function
段階的に実行すると理解できますが、しばらくすると(コードを見て、アラートを出します)