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
sridevi911Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

p_parthaCommented:
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)

Partha
0
ArunkumarCommented:
good one partha !
0
HemanthaKumarCommented:
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.FormatMsgWithDoclinks( 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
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

HemanthaKumarCommented:
Small correction in declarations Use this for newsletter object

Dim newsletter As NotesNewsletter
0
p_parthaCommented:
Hemanth
I am sure your code will not work for all documents. As unprocessed will return one...

Partha
0
HemanthaKumarCommented:
When he selects all docs in the view by using Ctrl + A, then it will.
0
p_parthaCommented:
yes that will , but there is a chance that the user selects "All documents from the export option " 

:-)

Partha
0
HemanthaKumarCommented:
Well yes.. that is true ! I almost forgot that option.
0
p_parthaCommented:
Hemanth,
But by all means it was a good code..

Partha
0
sridevi911Author Commented:
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




0
sridevi911Author Commented:
I've increased 40 points. thanks
0
p_parthaCommented:
     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)


      
0
p_parthaCommented:
change the view name to ur view

Partha
0
p_parthaCommented:
Does it work?

Partha
0
qwaleteeCommented:
Hi sridevi911,

Are you saying that you want the grand total count to consider each entry separately (so that one document can add many to the count), or do yuo want to count just documents? From the way you phrased it, I can't tell which is the "problem" and which is the "soltion" that you do want.

The following will get an all rows count from the view, if the view s a "flat view" (i.e., no catgeory columns):

Const viewName = "somethingor other"
Dim s as new NotesSession
MsgBox s.currentDatabase.getView(viewName).createViewNav.getFirst.siblingCount


The following variation will get an actual document count:

Const viewName = "somethingor other"
Dim s as new NotesSession
MsgBox s.currentDatabase.getView(viewName).allEntries.count



Best regards,
qwaletee
0
sridevi911Author Commented:
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.






0
p_parthaCommented:
Use Qwalette';s method...

Set db = session.CurrentDatabase
    Set view = db.getview("pp.viewww")
    Set nav = view.CreateViewNav
    count = nav.getFirst.siblingCount

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)


Partha


0
sridevi911Author Commented:
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



0
ArunkumarCommented:
Msgbox "Total number of records FTP'd are : " & , s.currentDatabase.getView(viewName).allEntries.count
, 0+64+0 , "Exported Document Count"


-Arun.
0
ArunkumarCommented:
use the above messagebox statement for your convinience.

and the points ?
0
sridevi911Author Commented:
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).createViewNav.getFirst.siblingCount
End Sub

Now when I use the code by Arun I get script errors.

0
p_parthaCommented:
Const viewName = "Admin\ExportTextFTP 3.0A"
    Dim s As New NotesSession
    Msgbox "Total Number of records updated are :   " & s.currentDatabase.getView(viewName).createViewNav.getFirst.siblingCount

Partha
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
p_parthaCommented:
or use this
      Msgbox "Total number of records FTP'd are : " &  session.currentDatabase.getView("viewname").allEntries.count, 0+64+0 , "Exported Document Count"


Partha
0
sridevi911Author Commented:
Thanks experts.
It works fine now.
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.