Ich hab's im Querysave einer Maske mal so gelöst:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument, docSearch As NotesDocument
Dim dc As NotesDocumentCollection
Dim view As NotesView
Dim key As String
Set db = session.currentDatabase
Set uidoc = ws.currentDocument
Set doc = uidoc.document
Set view = db.getView("abgestimmt")
key = doc.laser(0)
Set docSearch = view.GetDocumentByKey (key )
If Not (docSearch Is Nothing) Then
Messagebox key + " , Sie haben schon abgestimmt !"
continue = False
Exit Sub
End If
da ich 2 kriterien hab (thema und username) brauch ich 2 keys.
in der hilfe hab ich gelesen, dass man auch einen array nehmen kann.
hab dann dein script genommen und ein wenig umgeändert:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim docSearch As NotesDocument
Dim dc As NotesDocumentCollection
Dim view As NotesView
Dim key(1 To 2) As String
Set db = session.currentDatabase
Set uidoc = ws.currentDocument
Set doc = uidoc.document
Set view = db.getView("Auswertung")
key(1)=uidoc.FieldGetText("thema")
key(2)=uidoc.FieldGetText("name")
Set docSearch = view.GetDocumentByKey( key )
If Not (docSearch Is Nothing) Then
Messagebox "Sie haben schon abgestimmt !"
continue = False
Exit Sub
End If
End Sub
bei Set docSearch = view.GetDocumentByKey( key ) kommt aber eine fehlermeldung: too many keys
bei der ansicht ist in der ersten spalte das thema und in der zweiten der name.
sortiert hab ichs nach kategorie.
ja ok ok...
aber ich bin noch nicht fertig hier.
am anfang hatte ich ja formel sprache und da hatte ich noch diesen befehl:
@Contains(@Name([CN];@UserName);@DbLookup("":"NoCache";"";"(Ansicht2)";"Grupp1";2))
ansicht2 enthält 2 spalten. in der ersten steht grupp1, grupp2 usw. in der 2 eine text liste mit mehreren usernamen.
ziel ist es zu prüfen ob der user in einer bestimmten gruppe ist.
funktioniert hat das schon aber wie mach ich das jetzt in lotus script?