Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1821
  • Last Modified:

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



0
dancinmoonlt
Asked:
dancinmoonlt
  • 4
  • 4
  • 2
2 Solutions
 
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
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now