Printing a dynamic collection of documents using Lotusscript

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



dancinmoonltAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dancinmoonltAuthor 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
0
marilyngCommented:
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.


0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

dancinmoonltAuthor 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
0
marilyngCommented:
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
0
Sjef BosmanGroupware ConsultantCommented:
Could you give some explanation why you gave a C??
0
dancinmoonltAuthor 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
0
Sjef BosmanGroupware ConsultantCommented:
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
0
dancinmoonltAuthor 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
0
Sjef BosmanGroupware ConsultantCommented:
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 ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.