Hello
I created the following Formula to create a new document with content through an action button:
kat := @Prompt([OkCancelEdit]; “Neue Kategorie”; “Geben Sie eine neue Kategorie ein.”; “”);
@If(kat=“”;@True;
@Command([Compose]; “”; “kat”) +
@SetField( “kat” ; kat ) +
@Command([FileSave]) +
@Command([CloseWindow]))
However I always get an error that a number is being expected and I don’t know where that error occurs.
Subject: Action Button to Create Document
Hi,
You can’t use the plus sign (+) execute more than one command from within an @If. You need to use the @Do function when you want to do this.
@If(kat=“”;@True; @Do (@Command([Compose]; “”; “kat”) ;
@SetField( “kat” ; kat ) ;
@Command([FileSave]) ;
@Command([CloseWindow])))
Emily.
Subject: RE: Action Button to Create Document
Thanks for your input however I chose now the LS Version. I didn’t know about the @DO function.I think in Notes 5 I have used the “+” version a few times but that was ages ago.
Subject: Action Button to Create Document
Have you tried LotusScript?
Dim db As NotesDatabase
Dim session As New NotesSession
Dim newdoc As NotesDocument
Dim strInput As String
Set db = session.currentdatabase
'Prompt user
strInput = Inputbox$("Please enter your comments below:")
If strInput = "" Then
Print "Operation cancelled by user."
Exit Sub
End If
'Create new document
Set NewDoc = New NotesDocument(db)
NewDoc.Form = "kat"
NewDoc.kat = strInput
Call newdoc.Save(True, False)
ST
Subject: RE: Action Button to Create Document
Hi Stephen
That code just works like a charm.