Solved

question regarding a view

Posted on 2003-10-21
24
231 Views
Last Modified: 2013-12-18
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
0
Comment
Question by:sridevi911
  • 10
  • 6
  • 4
  • +2
24 Comments
 
LVL 14

Expert Comment

by:p_partha
ID: 9595741
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
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9595951
good one partha !
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9598644
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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9598657
Small correction in declarations Use this for newsletter object

Dim newsletter As NotesNewsletter
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9598860
Hemanth
I am sure your code will not work for all documents. As unprocessed will return one...

Partha
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9598914
When he selects all docs in the view by using Ctrl + A, then it will.
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9598917
yes that will , but there is a chance that the user selects "All documents from the export option " 

:-)

Partha
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9598944
Well yes.. that is true ! I almost forgot that option.
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9598950
Hemanth,
But by all means it was a good code..

Partha
0
 

Author Comment

by:sridevi911
ID: 9599321
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
 

Author Comment

by:sridevi911
ID: 9599326
I've increased 40 points. thanks
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9599498
     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
 
LVL 14

Expert Comment

by:p_partha
ID: 9599520
change the view name to ur view

Partha
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9599732
Does it work?

Partha
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 125 total points
ID: 9599806
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
 

Author Comment

by:sridevi911
ID: 9599887
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
 
LVL 14

Assisted Solution

by:p_partha
p_partha earned 145 total points
ID: 9599898
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
 

Author Comment

by:sridevi911
ID: 9600050
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
 
LVL 9

Assisted Solution

by:Arunkumar
Arunkumar earned 20 total points
ID: 9600125
Msgbox "Total number of records FTP'd are : " & , s.currentDatabase.getView(viewName).allEntries.count
, 0+64+0 , "Exported Document Count"


-Arun.
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9600131
use the above messagebox statement for your convinience.

and the points ?
0
 

Author Comment

by:sridevi911
ID: 9600273
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
 
LVL 14

Accepted Solution

by:
p_partha earned 145 total points
ID: 9600554
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
 
LVL 14

Expert Comment

by:p_partha
ID: 9600581
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
 

Author Comment

by:sridevi911
ID: 9600653
Thanks experts.
It works fine now.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question