We help IT Professionals succeed at work.

Printing a dynamic collection of documents using Lotusscript

dancinmoonlt
dancinmoonlt asked
on
Medium Priority
2,029 Views
Last Modified: 2013-12-18
Hi,

Could some one please shed some light on this???

I need to print a set of documents programmatically based on certain selection criteria...

ways I have tried.

a)
Set db = session.CurrentDatabase
Set uiview = workspace.CurrentView
Set view = db.GetView(uiview.ViewName)
Set collection = view.GetAllDocumentsByKey(session.CommonUserName)
If Not( collection Is Nothing ) Then
      If collection.Count > 0 Then
      Set doc = collection.GetFirstDocument
      Do Until doc Is Nothing
      Call uiview.SelectDocument(doc)
      'Call uiview.Print(1, , , , , , , , )
      Set doc = collection.GetNextDocument(doc)
Loop
Else
Messagebox "There were no Leads listed for the current user to Print.", 0+64 , "Print Cancelled."
End If
End If

This was the best method but if someone clicks cancel on the lotus notes simulated print message then we get RBOD.. and notes crashes.

Trial2:
b)
Set db = session.CurrentDatabase
      Set vwTemplate = db.GetView("openLeads")
      selectionFormula = "SELECT Form = ""Lead"" & !(@Contains(Disposition;""Closed"")) & @LowerCase(AcctMngtr) = @LowerCase(@Name([CN];@UserName))"
      Set vw =  db.CreateView("tmp" + session.CommonUserName,selectionFormula,vwTemplate)
      Msgbox vw.Name
      If db.Open("","") Then
            Set uidb = ws.CurrentDatabase
            Call uidb.OpenView(vw.Name)            
      End If

I thought if I am able to show this view to user... then I can print the documents using an action button... with FL commands

@Command([ViewExpandAll]);
@Command([EditSelectAll]);
@Command([FilePrint]);

:( but nothing so far seems to help...

kindly shed your valuble thoughts it will be of great help.

Regards,
ELavarasi



Comment
Watch Question

Groupware Consultant
CERTIFIED EXPERT
Commented:
You ain't gonna like this... Printing in Notes sucks :(

Nevertheless, it should be possible when you have selected all documents you want to print:
    Set uidoc= EditDocument(...., doc) in read-only mode
    Call uidoc.Print
    Call uidoc.Close

It is far better to use some third-party tool, like Notes2Paper or Midas to do what you want. Or export via COM to Word.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Hi sjef, thank you for your thoughts... wont my second solution bring some possiblity.... that is "IF I AM ABLE TO SHOW THIS DYNAMICALLY CREATED VIEW TO THE USER"... even then my problem would be solved.... using the following

"then I can print the documents using an action button... with FL commands

@Command([ViewExpandAll]);
@Command([EditSelectAll]);
@Command([FilePrint]);"

Cheers
e j l

Commented:
If you could show selected documents, then you can use the @Commands.. so what I used to do (front end of course) , was to put selected documents in a folder, or change the view to show selected only and then print the view, all documents, then restore to show all.

Similarly, you can select documents via the document collection, dump them into a folder and then print everything in the folder. Or use a SELECT agent to select the documents, and a second agent to show selected, and then print view.

So with @Commands, you have to nest a few agents together, and only call the next one if the first one works, such as empty folder first, then put selected into folder.

Or you can do the selection and dump to folder, open the folder so the user can review the documents and a print button in the folder.

Alternatively,  here is another tech note from IBM:
http://www-1.ibm.com/support/docview.wss?rs=0&uid=swg21096065

I don't have a copy of my workaround @Command Print agents here, but will upload them when I get home today, if you like.


Author

Commented:
Hi marilying,

Thank you for your suggesstion. I have another doubt, since this is a global application. What will happen if multiple users try to print a set of documents from various locations at the same time... Which user's document collection will go in to the folder.

I didnt exactly understand what the print agents will do.

regards,
e j l
Commented:
I used Private folders.

Depends on what you want to accomplish.   And usually there are two buttons: printall and print selected.  If you want to select certain documents without the user doing this, then you need an agent to select and move documents to a private folder, switch to the folder, and then call your

@Command([SelectAll]);
@Command([FilePrint]);

---------
Or if they SELECT documents to be printed, use the @Command([ViewSelectedDocuments]), then SelectAll, FilePrint
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
Could you give some explanation why you gave a C??

Author

Commented:
The answer that you gave was not my solution. But I accepted your answer because, you did shed some light about printing documents in Notes.

Why does C affect your rating. If so let me know... and if I can change it, I will do so.

I basically gave C as becuase I didnt get a solution from the answers, I only got some information.

Regards,
e j l
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
And what was your solution?

A= Absolutely correct
B= Better than nothing
C= Crap ;) (it's sometimes better to ask for a refund)

Please read:
    http://www.experts-exchange.com/help.jsp#hi73

Author

Commented:
:) God I was not aware of it... I would have given B. Let me know if this can be changed.

Regards,
e j l
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
Yes, you can. Put a question in Community Support asking for this question to be reopened (with a link of course).

PS The A/B/C legend above is entirely mine ;)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.