sridevi911
asked on
question regarding a view
Hi experts,
i've a view and I export that view into my PC by clicking a button in that view which basically runs an agent.
this agent uses a Formula Language and exports the selected or all the documents in tabular text and creates a text file in my pc. This is fine and works good.
However, I want some additional functionality here.
I want to run another agent when I click the same export button in this view.
this agent should just e-mail me the total numbers of documents exported to the text file.
I know I can create another column in the view and put the total , but I do not want to do it that way. I do not want to change the current format of the text file.
I want the total number of documents in that view via an e-mail in other words.
Please help
thanks
Sridevi
i've a view and I export that view into my PC by clicking a button in that view which basically runs an agent.
this agent uses a Formula Language and exports the selected or all the documents in tabular text and creates a text file in my pc. This is fine and works good.
However, I want some additional functionality here.
I want to run another agent when I click the same export button in this view.
this agent should just e-mail me the total numbers of documents exported to the text file.
I know I can create another column in the view and put the total , but I do not want to do it that way. I do not want to change the current format of the text file.
I want the total number of documents in that view via an e-mail in other words.
Please help
thanks
Sridevi
good one partha !
The question says " ...exports the selected or all the documents ..."
So the agent will be set to run on selected docs. The following script does send the doclinks formatted to the recepient
dim session as new notessession
dim db as notesdatabase
dim col as NotesDocumentCollection
Dim newsletter As New NotesNewsletter
set db = session.currentdatabase
set view = db.getview("<your viewname>")
set col = db.UnprocessedDocuments
count = col.Count
if count > 0 then
Set newsletter = New NotesNewsletter( col )
Set maildoc = newsletter.FormatMsgWithDo clinks( db )
maildoc.form = "memo"
maildoc.subject = "Number of documents imported was " & count
maildoc.sendto = "<whateveremail id u want to use>"
maildoc.send(false)
End if
~Hemanth
So the agent will be set to run on selected docs. The following script does send the doclinks formatted to the recepient
dim session as new notessession
dim db as notesdatabase
dim col as NotesDocumentCollection
Dim newsletter As New NotesNewsletter
set db = session.currentdatabase
set view = db.getview("<your viewname>")
set col = db.UnprocessedDocuments
count = col.Count
if count > 0 then
Set newsletter = New NotesNewsletter( col )
Set maildoc = newsletter.FormatMsgWithDo
maildoc.form = "memo"
maildoc.subject = "Number of documents imported was " & count
maildoc.sendto = "<whateveremail id u want to use>"
maildoc.send(false)
End if
~Hemanth
Small correction in declarations Use this for newsletter object
Dim newsletter As NotesNewsletter
Dim newsletter As NotesNewsletter
Hemanth
I am sure your code will not work for all documents. As unprocessed will return one...
Partha
I am sure your code will not work for all documents. As unprocessed will return one...
Partha
When he selects all docs in the view by using Ctrl + A, then it will.
yes that will , but there is a chance that the user selects "All documents from the export option "
:-)
Partha
:-)
Partha
Well yes.. that is true ! I almost forgot that option.
Hemanth,
But by all means it was a good code..
Partha
But by all means it was a good code..
Partha
ASKER
Experts, Though while exporting, the window asks to select, All Documents or Selected Documents, We have to select always ALL Documents. So we will select always ALL documents and hence I used Partha's code below.
dim session as new notessession
dim db as notesdatabase
set db = session.currentdatabase
set view = db.getview("<your viewname">)
count = view.allentries.count
set maildoc = db.createdocument
maildoc.form = "memo"
maildoc.subject = "Numbe rof documents imported was " & count
maildoc.sendto = "<whateveremail id u want to use>"
maildoc.send(false)
Now its doing its thing and sending me e-mail with the total count. However, there is one problem: This View has
one column which shows "Show Multiple Entries as Seperate Columns".
So for the first column in this view, the following is checked:
"Show Multiple Entries as Seperate Columns".
Becuase this is checked, if there are multiple values in the 1st column it will show a seperate entry.
But the count I get is not counting all the seperate entries. It is just counting the number of documents. thats it.
Hope I explained well.
Please advise
thanks
dim session as new notessession
dim db as notesdatabase
set db = session.currentdatabase
set view = db.getview("<your viewname">)
count = view.allentries.count
set maildoc = db.createdocument
maildoc.form = "memo"
maildoc.subject = "Numbe rof documents imported was " & count
maildoc.sendto = "<whateveremail id u want to use>"
maildoc.send(false)
Now its doing its thing and sending me e-mail with the total count. However, there is one problem: This View has
one column which shows "Show Multiple Entries as Seperate Columns".
So for the first column in this view, the following is checked:
"Show Multiple Entries as Seperate Columns".
Becuase this is checked, if there are multiple values in the 1st column it will show a seperate entry.
But the count I get is not counting all the seperate entries. It is just counting the number of documents. thats it.
Hope I explained well.
Please advise
thanks
ASKER
I've increased 40 points. thanks
Dim session As New notessession
Dim db As notesdatabase
Set db = session.currentdatabase
Dim view As notesview
Dim entryA As NotesViewEntry
Dim nav As NotesViewNavigator
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.getview("pp.viewww")
Set nav = view.CreateViewNav
Set entryA = nav.getFirstdocument
count = 0
While Not entryA Is Nothing
count = count + 1
Set entryA = nav.getNextDocument(entryA )
Wend
set maildoc = db.createdocument
maildoc.form = "memo"
maildoc.subject = "Number of documents imported was " & count
maildoc.sendto = "<whateveremail id u want to use>"
maildoc.send(false)
Dim db As notesdatabase
Set db = session.currentdatabase
Dim view As notesview
Dim entryA As NotesViewEntry
Dim nav As NotesViewNavigator
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.getview("pp.viewww")
Set nav = view.CreateViewNav
Set entryA = nav.getFirstdocument
count = 0
While Not entryA Is Nothing
count = count + 1
Set entryA = nav.getNextDocument(entryA
Wend
set maildoc = db.createdocument
maildoc.form = "memo"
maildoc.subject = "Number of documents imported was " & count
maildoc.sendto = "<whateveremail id u want to use>"
maildoc.send(false)
change the view name to ur view
Partha
Partha
Does it work?
Partha
Partha
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Partha It works but it takes a lot of time and my Lotus Notes hangs for more than 5 minutes then I receive the count e-mail.
I only have 1300 documents in the view.
This doucment size could go upto 10,000 next year. Than I guess it would take pretty good amount of time which is not good.
Not sure what to do here.
I only have 1300 documents in the view.
This doucment size could go upto 10,000 next year. Than I guess it would take pretty good amount of time which is not good.
Not sure what to do here.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent, Qwaletee and Partha. I used two agents here, One shows the Message box with the total count which Qwaletee has described above and then one sends an e-mail with the total count which has Partha's Logic above.
Now one small request. The message box is showing up with just the number 1300 (count) and thats it.
Nothing is there in the message box.
Can we make this message box a bit nicer.
I mean I want to show a message box which has the following text and count.
Total number of records FTP'd are : 1300
Thanks
Now one small request. The message box is showing up with just the number 1300 (count) and thats it.
Nothing is there in the message box.
Can we make this message box a bit nicer.
I mean I want to show a message box which has the following text and count.
Total number of records FTP'd are : 1300
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
use the above messagebox statement for your convinience.
and the points ?
and the points ?
ASKER
This is what I've and it works fine.
Sub Initialize
Const viewName = "Admin\ExportTextFTP 3.0A"
Dim s As New NotesSession
Msgbox s.currentDatabase.getView( viewName). createView Nav.getFir st.sibling Count
End Sub
Now when I use the code by Arun I get script errors.
Sub Initialize
Const viewName = "Admin\ExportTextFTP 3.0A"
Dim s As New NotesSession
Msgbox s.currentDatabase.getView(
End Sub
Now when I use the code by Arun I get script errors.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or use this
Msgbox "Total number of records FTP'd are : " & session.currentDatabase.ge tView("vie wname").al lEntries.c ount, 0+64+0 , "Exported Document Count"
Partha
Msgbox "Total number of records FTP'd are : " & session.currentDatabase.ge
Partha
ASKER
Thanks experts.
It works fine now.
It works fine now.
dim db as notesdatabase
set db = session.currentdatabase
set view = db.getview("<your viewname">)
count = view.allentries.count
set maildoc = db.createdocument
maildoc.form = "memo"
maildoc.subject = "Numbe rof documents imported was " & count
maildoc.sendto = "<whateveremail id u want to use>"
maildoc.send(false)
Partha