Page 1 sur 1

NotesDocumentCollection

MessagePublié: 23 Juin 2014 à 12:31
par VastoMarine
bonjour,

J'ai une vue catégorisée sur lequel je fais une recherche à l'aide d'un mot clé. Le résultat est renvoyé, dans le masque, ne respecte pas l'ordre d'encodage.
Exemple, recherche sur la composition de l'équipe de France (mot clé) - le résultat est Karim, Paul, Olivier, Antoine, et Mathieu
Alors que l'encodage est comme suit : Paul, Karim, Olivier, Mathieu, et Antoine

Code : Tout sélectionner
Sub Click(Source As Button)
   
   Dim uiwks As New NotesUIWorkspace
   Dim ses As New NotesSession
   Dim db As NotesDatabase
   Dim doc2 As NotesDocument
   Dim docA As NotesDocument
   Dim view As NotesView
   Dim View2 As NotesView
   Dim DC As NotesDocumentCollection
   Dim DCA As NotesDocumentCollection
   Dim xdoc As NotesDocument
   
   Dim var   
   Dim brol
   Dim brol1 As Variant
   Dim vDossier As String
   Dim keys, key As String
   
   Set db = ses.CurrentDatabase
   
   uidoc.EditMode= True ' ********************
   
   key = uidoc.fieldGetText("FIfldDBCBI")
   
   If key = "" Then
      
      Msgbox "La facture ne contient aucun numéro d'institution. Veuillez contacter l'agent traitant."
      
   Else
      
      Print "n° inst : " & key
      
      Set DCA = uiwks.PickListCollection(PICKLIST_CUSTOM, False, db.Server, db.FilePath, "AviewSousApplication1", "veuillez choisir un circuit d'approbation", "Circuits d'approbation", key)
      
   End If
   
   
   If DCA.Count = 0 Then
      
      Messagebox "Demande annulée"
      
      Call uidoc.Refresh
      
      Call doc.save(False,True)   
      
   Else   
      
      
      For i = 1 To 5
         Call Doc.ReplaceItemValue( "Label_Role" & i , "")
         Call Doc.ReplaceItemValue( "fldAction" & i , "")
         Call Doc.ReplaceItemValue( "fldRole" & i , "")
         Call Doc.ReplaceItemValue( "OF" & i , "")
         Call Doc.ReplaceItemValue( "fldParam", "")   
      Next      
      
      Set Doc3 = DCA.GetFirstDocument
      
      Set view = db.GetView( "AviewCircuit1" )
      
      keys = Doc3.SAApplication(0) + "###" + Doc3.SAAbrev(0)
      
      Set DC = view.GetAllDocumentsByKey(keys)
      
      i=1
      
      Set Doc2 = DC.GetFirstDocument
      
      Do Until Doc2 Is Nothing
         
         If Doc2.CApplication(0) = Doc3.SAApplication(0) And  Doc2.CFlux(0) = Doc3.SAAbrev(0)  Then
            
            Call Doc.ReplaceItemValue( "Label_Role" & i , Doc2.CRole(0))
            Call Doc.ReplaceItemValue( "fldAction" & i , Doc2.CAction(0))
            Call Doc.ReplaceItemValue( "fldRole" & i , Doc2.CUtilisateurs)
            
            If Lcase(Doc.getitemvalue("Label_Role" &Cstr(i))(0)) = "directeur" Then
               Call Doc.replaceitemvalue("Directeurs", Doc2.CUtilisateurs)
            End If
            
            If Lcase(Doc.getitemvalue("Label_Role" &Cstr(i))(0)) = "agent receptionnaire" Then
               Call Doc.replaceitemvalue("AgtReceptionnaire", Doc2.CUtilisateurs)
            End If
            
            Call Doc.ReplaceItemValue( "fldParam", Doc2.CRefus(0))   
            Call Doc.ReplaceItemValue( "ColTypeRapport", Doc2.CSousApplication(0))
            
            Call Doc.replaceItemValue("Flux", Doc2.CFlux(0))
            
         End If
         
         Set Doc2 = DC.GetNextDocument(Doc2)
         
         i = i + 1
      Loop   
      

      Call uidoc.Refresh
      Call doc.ComputeWithForm( False, False )
      Call Doc.save(False,True)
      
   End If
   
End Sub

Re: NotesDocumentCollection

MessagePublié: 23 Juin 2014 à 14:05
par Michael DELIQUE
salut

dans une collection l'ordre des document est sur la date de creation des documents, apres faut appliquer un algorithme de tri => viewtopic.php?f=55&t=20606

Re: NotesDocumentCollection

MessagePublié: 23 Juin 2014 à 22:22
par roubech
sinon, passer par NotesViewNavigator et NotesViewEntry pour garder l'ordre de la vue