Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: MrMagoo am 17.11.03 - 15:43:37

Titel: form Abfrage per Script
Beitrag von: MrMagoo am 17.11.03 - 15:43:37
Hallo zusammen,

in der Formelsprache gibt es ja folgende Formel zur Abfrage einer Maske um z.B. Tochterdokumente zu erstellen

@If(Form != "Maske1" ;@Prompt([OK];"Failure";"If you want to create ...you have to select an other Mask");@Command([Compose];"";"Mask"))
Ist es auch möglich dies in Script Abzufragen. Also nur wenn ein Dokument einer bestimmten Maske makiert ist, wird das neue Dok erstellt.

Danke
Titel: Re:form Abfrage per Script
Beitrag von: Driri am 17.11.03 - 15:51:00
Hi,

sollte z.B. so gehen :

Dim ws as New NotesUIWorkspace
Dim uidoc as NotesUIDocument
Dim doc as NotesDocument

Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document

If doc.Form <> "Maske1" Then
   MessageBox...
   Exit Sub
Else
   ...
End If
Titel: Re:form Abfrage per Script
Beitrag von: MrMagoo am 17.11.03 - 16:06:58
Danke für die Antwort @Driri,
macht er so aber leider nicht, bei
set doc = uidoc.doument  gibt es die Fehlermeldung "Object Variable not set" ich will dies in einer Ansicht benutzen in der dann ein doc ausgewählt ist
Gruß
Titel: Re:form Abfrage per Script
Beitrag von: MrMagoo am 17.11.03 - 16:15:27
ich bin jetzt mal mit einer collection auf das Dok gegangen, sagt jetzt TypeMismatch bei If doc.Form <> "Maske"  Then

Sub Initialize
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim collection As NotesDocumentCollection
   Dim doc As NotesDocument
   
   Set db = session.CurrentDatabase
   Set collection = db.unprocessedDocuments
   Set doc = collection.GetFirstDocument
   If doc.Form <> "Maske"  Then
      Msgbox "Please select an other dok"

   Else
      Msgbox "Geht doch"      
   End If
End Sub
Titel: Re:form Abfrage per Script
Beitrag von: ata am 17.11.03 - 16:24:06
... noch ne kleine Korrektur

If doc.Form(0) <> "Maske1" Then

ata
Titel: Re:form Abfrage per Script
Beitrag von: MrMagoo am 17.11.03 - 16:25:42
thx ata
so funzt es
Sub Initialize
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim collection As NotesDocumentCollection
   Dim doc As NotesDocument
   
   Set db = session.CurrentDatabase
   Set collection = db.unprocessedDocuments
   Set doc = collection.GetFirstDocument
   If doc.form(0) <> ("Maske")Then
      
      Msgbox "Please select..."
      
   Else
      Msgbox "Geht doch"      
   End If
End Sub