Page 1 sur 1

Vue intégrée dans un masque

MessagePublié: 18 Oct 2011 à 08:24
par clementbp
Bonjour à tous.

Je vais essayer de vous expliquer clairement mon problème.

Je voudrais dans un masque, afficher une vue intégrée dans laquelle les documents à afficher dépendent d'un des champs de mon document.


Je m'explique :

Dans mon document, je récupère dans le champ "IDDocumentsAffiches" les ID des documents que je voudrais afficher.
Il faudrait que dans ma vue intégrée, n'apparaisse que les documents dont les ID se trouve dans mon champ "IDDocumentsAffiches".

J'espère que mon explication a été suffisamment claire

Pensez-vous que cela est possible ?

Merci de votre aide

MessagePublié: 18 Oct 2011 à 08:43
par Michael DELIQUE
salut

ce que tu veux faire s'appel un restricttocatégory.

- dans ta vue intégré tu ajoute une colonne catégorisé/trié qui affichera les différente valeurs possible du champ IDDocumentsAffiches
- dans ton masque qui contient la vue intégré tu va dans les parametre de celle si et tu met ton champ IDDocumentsAffiches dans Restrictocatégory

et hop c'est fait

MessagePublié: 18 Oct 2011 à 08:48
par clementbp
Merci pour ta réponse

J'ai fais quelque tests par contre j'ai remarqué que :

- quand il n'y a qu'un seul ID dans le champ IDDocumentsAffiches cela fonctionne
- quand il y a plusieurs ID différents dans le champ IDDocumentsAffiches, il me mets qu'il est impossible d'afficher la vue.

Y a t il une solution pour que cela fonctionne avec plusieurs ID

MessagePublié: 18 Oct 2011 à 09:11
par Michael DELIQUE
pas que je sache généralement on fait l'inverse on met l'id du document parent dans les documents enfants pour pouvoir avoir tous les documents associés

MessagePublié: 18 Oct 2011 à 09:15
par clementbp
Oui j'ai déja vu le cas dans ce sens là mais moi je voudrais faire l'inverse.

En fait dans mon document parent, je voudrais selectionner les documents enfant à afficher.

As tu déja vu ou fait quelque chose de ce type ???

MessagePublié: 18 Oct 2011 à 09:23
par Michael DELIQUE
tes multiple id tu les a bien passé sous forme de liste dans le restrict catégory ?

MessagePublié: 18 Oct 2011 à 09:36
par clementbp
Mon champ IDDocumentsAffiches est de type "Liste de dialogue"

J'ai mis dans les paramètres de ma vue intégrée , dans "Afficher une seule catégorie" la formule IDDocumentsAffiches.

Après peut être que j'ai raté quelque chose !!

MessagePublié: 18 Oct 2011 à 10:30
par Michael DELIQUE
pas forcement, il faut faire des essais.

tu prend une liste id que tu colle dans le restictocatégory a laplace du champ uneliste de cette forme "id1":"id2":"id3" et tu regarde ce que ça donne.

si ça marche pas, c'es que c'est impossible si ça marche c'est que ton champ ne renvois pas les bonnes informations

MessagePublié: 18 Oct 2011 à 10:57
par clementbp
Bon après quelque tests je n'y arrive toujours pas.
Il semblerait donc que restictocatégory n'accepte qu'une valeure d'entrée
Dommage il faut que je trouve une autre solution pour faire cela.

Si quelqu'un à une idée !!

Merci de votre aide

MessagePublié: 18 Oct 2011 à 12:02
par Michael DELIQUE
j'ai peut être une idée tordu :

au lieux d'une vue tu fais un dossier partagé devenant privé à la premiere utilisation qui va remplacer ta vue intégré, ça sera donc un dossier intégré. tu oubli le restrictocatégory.

a chaque ouverture du masque tu fait un petit code lotus script qui va mettre les document voulu dans le dossier et qui va les retirer à la fermeture et hop

MessagePublié: 18 Oct 2011 à 13:34
par clementbp
Je voudrais essayer ta technique par contre si je comprend bien, il faut que je fasse un bout de code qui me permette de selectionner les documents à partir des ID que je récupère et de les envoyer dans un dossier!!!!

Bon je vais essayé alors

MessagePublié: 18 Oct 2011 à 14:07
par Michael DELIQUE
ouaip c'est ça

2 fonctions qui peuvent t'aider :

Code : Tout sélectionner
Public Function FolderAdd(wvrFolder As Variant,wvrObjectAdd As Variant) As Integer

   Dim FolderName As String
   Dim Doc As NotesDocument
   Dim Collection As NotesDocumentCollection
   Dim vwView As NotesView
   
   On Error Goto CatchError
   
   FolderAdd = 0
   
   If DB Is Nothing Or Session Is Nothing Then
      Set Session = New NotesSession
      Set DB = Session.CUrrentdatabase
   End If
   
   If testVariant(wvrFolder) = False Then
      Error 9999,"wvrFolder is Empty"
      Exit Function
   End If   
   
   If testVariant(wvrObjectAdd) = False Then
      Error 9999,"wvrObjectAdd is Empty"
      Exit Function
   End If   
   
   Select Case Ucase(Typename(wvrFolder))
   Case "NOTESVIEW"
      Set vwView = wvrFolder
   Case "NOTESUIVIEW"
      Set vwView = wvrFolder.view
   Case "STRING"
      Set vwView = db.GetView(Trim(Cstr(wvrObjectAdd)))
      If vwView Is Nothing Then
         Error 9999,{Folder '}+ Trim(Cstr(wvrObjectAdd))+{' Not Found}
         Exit Function
      End If
   End Select
   
   If vwView Is Nothing Then
      Error 9999,{Folder is Nothing}   
      Exit Function
   Else   
      FolderName = Trim(vwView.Name)
      Set vwView = Nothing
   End If
   
   Select Case Ucase(Typename(wvrObjectAdd))
   Case "NOTESDOCUMENT"   
      Set Doc = wvrObjectAdd
      If Not Doc Is Nothing Then
         Call Doc.PutInFolder( FolderName )
         FolderAdd = 1
         Set Doc = Nothing
      End If
   Case "NOTESDOCUMENTCOLLECTION"
      Set Collection = wvrObjectAdd
      If Not Collection Is Nothing Then
         If Collection.count > 0 Then
            FolderAdd = Collection.Count
            Call Collection.PutAllInFolder( FolderName )
         End If
         Set Collection = Nothing
      End If   
   Case "NOTESVIEW"
      Set vwView = wvrObjectAdd      
   Case "NOTESUIVIEW"
      Set vwView = wvrObjectAdd.view
   Case "STRING"   
      Set vwView = db.GetView(Trim(Cstr(wvrObjectAdd)))
   Case Else
      Error 9999,"wvrObjectAdd Bad TypeName : "+Typename(wvrObjectAdd)
      Exit Function
   End Select
   
   If Not vwView Is Nothing Then
      Set Doc = vwView.GetFirstDocument
      While Not Doc Is Nothing
         Call Doc.PutInFolder( FolderName )
         FolderAdd = FolderAdd+1
         Set Doc = vwView.GetNextDocument(Doc)
      Wend
      Set vwView = Nothing
   End If
   
   Call vwView.refresh   
   Set vwView= Nothing
   
   Exit Function
CatchError:
   Msgbox "("+Structure_Log+" : "+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Set vwView = Nothing
   FolderAdd = 0
   Exit Function
End Function


Code : Tout sélectionner
Public Function FolderDelete(wvrFolder As Variant,wvrObjectAdd As Variant,wnbAll As Boolean) As Integer

   Dim FolderName As String
   Dim Doc As NotesDocument
   Dim Collection As NotesDocumentCollection
   Dim EntryCollection As notesViewEntryCollection
   Dim vwView As NotesView
   
   On Error Goto CatchError
   
   FolderDelete = 0
   
   If DB Is Nothing Or Session Is Nothing Then
      Set Session = New NotesSession
      Set DB = Session.CUrrentdatabase
   End If
   
   If testVariant(wvrFolder) = False Then
      Error 9999,"wvrFolder is Empty"
      Exit Function
   End If   
   
   Select Case Ucase(Typename(wvrFolder))
   Case "NOTESVIEW"
      Set vwView = wvrFolder
   Case "NOTESUIVIEW"
      Set vwView = wvrFolder.view
   Case "STRING"
      Set vwView = db.GetView(Trim(Cstr(wvrObjectAdd)))
      If vwView Is Nothing Then
         Error 9999,{Folder '}+ Trim(Cstr(wvrObjectAdd))+{' Not Found}
         Exit Function
      End If
   End Select
   
   If vwView Is Nothing Then
      Error 9999,{Folder is Nothing}   
      Exit Function
   Else   
      FolderName = Trim(vwView.Name)      
   End If
   
   If wnbAll = False Then
      
      Set vwView = Nothing
      
      If testVariant(wvrObjectAdd) = False Then
         Error 9999,"wvrObjectAdd is Empty"
         Exit Function
      End If   
      
      Select Case Ucase(Typename(wvrObjectAdd))
      Case "NOTESDOCUMENT"   
         Set Doc = wvrObjectAdd
         If Not Doc Is Nothing Then
            Call Doc.RemoveFromFolder( FolderName )
            FolderDelete = 1
            Set Doc = Nothing
         End If
      Case "NOTESDOCUMENTCOLLECTION"
         Set Collection = wvrObjectAdd
         If Not Collection Is Nothing Then
            If Collection.count > 0 Then
               FolderDelete = Collection.Count
               Call Collection.RemoveAllFromFolder( FolderName )
            End If
            Set Collection = Nothing
         End If   
      Case "NOTESVIEW"
         Set vwView = wvrObjectAdd      
      Case "NOTESUIVIEW"
         Set vwView = wvrObjectAdd.view
      Case "STRING"   
         Set vwView = db.GetView(Trim(Cstr(wvrObjectAdd)))
      Case Else
         Error 9999,"wvrObjectAdd Bad TypeName : "+Typename(wvrObjectAdd)
         Exit Function
      End Select
      
      If Not vwView Is Nothing Then
         Set Doc = vwView.GetFirstDocument
         While Not Doc Is Nothing
            Call Doc.RemoveFromFolder( FolderName )
            FolderDelete = FolderDelete+1
            Set Doc = vwView.GetNextDocument(Doc)
         Wend
         Set vwView = Nothing
      End If
   Else
      Set EntryCollection = vwView.AllEntries
      If Not EntryCollection Is Nothing Then
         If EntryCollection.count > 0 Then
            FolderDelete = EntryCollection.Count
            Call EntryCollection.RemoveAllFromFolder(FolderName)
         End If
         Set EntryCollection = Nothing
      End If         
   End If
   
   Call vwView.refresh   
   Set vwView= Nothing
   Exit Function
CatchError:
   Msgbox "("+Structure_Log+" : "+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Set vwView = Nothing
   FolderDelete = 0
   Exit Function
End Function
[/code]

MessagePublié: 20 Oct 2011 à 15:28
par LSong
tu peu regarder du coté de
@SetViewInfo
[SETVIEWFILTER]

ca permet de mettre un filtre sur un champs
je ne sais pas si on peu y mettre une multivaluation mais ca vaux le coup de regarder