Solved

question regarding a view

Posted on 2003-10-21
24
228 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now