Question on "print" and "right" function

These are probably easy questions for the more experienced LotusScript developers, but since I’m not…

1/What instruction should I use to print out NEWDOC in below code?

2/ How can I only put the 5 most right digits of PFNumber into newdoc.PFNumber. (I always get a Type Mismatch).

doc.PFNumber is a “text” field , computed with following value:

“MC” + @Repeat(“0”;5 - @Length(@Trim(@Text(SeqNumber))))+ @Text(SeqNumber)

newdoc.PFNumber is also “text”, computed with value PFNumber.

Here’s the code:

Sub Click(Source As Button)

Dim ss As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim newdoc As NotesDocument

Dim wk As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim PFnum As String



Set db=ss.currentdatabase

Set uidoc=wk.currentdocument

Set doc=uidoc.document

Set newdoc=New notesdocument(db)

newdoc.form="PrintLabel"

newdoc.PFShipTo1=doc.PFShipTo1

newdoc.PFShipTo2=doc.PFShipTo2

newdoc.PFShipTo3=doc.PFShipTo3

newdoc.PFShipTo4=doc.PFShipTo4

newdoc.PFShipTo5=doc.PFShipTo5

newdoc.PFShipTo6=doc.PFShipTo6

newdoc.PFNumber=doc.PFNumber

newdoc.PFtype=doc.PFtype



Call newdoc.save(False, True)

Call wk.EditDocument(True,newdoc)

End Sub

Subject: RE: Question on “print” and “right” function

Herwin,

Re: the type mismatch, the line should read doc.PFNumber(0) as all fields are considered to be arrays (even if there is only one value in them)

To get the 5 right digits of the field, use the following…

newdoc.PFNumber=Right(doc.PFNumber(0),5)

HTH

Mike

Subject: RE: Question on “print” and “right” function

Great!!!Thx for your quick response, Mike.

Any idea about the print?

Subject: RE: Question on “print” and “right” function

All I can think is to have an agent that runs @Command([fileprint]) and then call the agent from your script

(You can;t evaluate @Commands in script)

Apart from that - have you searched the forum for ideas?

Subject: Printing

You cant print from a NotesDocument

but you can from a NoytesUIDocument

Dim uid as NotesUiDocument

set uid = wk.EditDocument(True,newdoc)

Call uid.Print( [ numCopies%, [, fromPage%, [, toPage%, [,draft ]]]] )

will automatically print to teh currently selected printer

call uid.Print

pops up the manual box

Subject: RE: Printing

grateful thanks!