Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext


Manish Savla 26.Jul.05 04:48 PM a Web browser
Applications Development All Releases All Platforms



Hello,

I have a requirement where I have 2 databases. db.nsf and db2.nsf.
db.nsf has 960,000 documents. db2.nsf has 300,000 documents. I have to get a key value from db.nsf, and search in db2.nsf, and update the flags accordingly.

I have defined the following algorithm, and have a code also. The code works fine, but it runs for atleast 8-10 hrs or a day. I am not sure why. I have following questions,

1.
Is there a way that I can improove the processing time by making changes in this code?

2.
This line, Print "Proccessing document # - " + Cstr(count%) - Shows me Processing document # - 32767. But count then does not changes, but I can see the different fieldvalue1 upon next document. The counter works fine from 1..32767, but then stops increamenting, I am not sure why? Since the agent runs for hours and hours, I have set an email which will give me an update, how many docs have been processed? But since the count is not going further after 32767, I can not figure out how many documents have been processed?


Algorithm

1.
Get the key from view ALL within db.nsf
2.
Search in db2 for a key from db.nsf
3.
If the count >= 3 then,
3.1
Update a flag "dbvalidemail" within db2.nsf
3.2
Update a flag "dbemailbounced" within db2.nsf
3.3
Update a flag "dbvalidemail" within db.nsf
4.
If the count = 0 then,
4.1
Update a flag "dbvalidemail" within db

AGENT CODE -

Sub Initialize

Dim varray() As String
Dim it As NotesItem
Dim i As Integer
Dim vc As NotesViewEntryCollection
Dim strProdNo As String
Dim ns As New NotesSession
Dim ndt As New NotesDateTime ("") 'a time for our notes document and log messages
Dim theTime As String 'a string for the time
Dim errorlog As NotesLog
Dim doc2 As NotesDocument
Set db = ns.Currentdatabase
Set errorlog = ns.Createlog("logdb")
Set logdb = New Notesdatabase (db.server, "logdatabase.nsf" )
theTime$ = ndt.LocalTime
Dim view As NotesView
Dim doc As NotesDocument
Set view = db.GetView( "ALL" )
Set vc = view.AllEntries
count% = 0
X = 1
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
count% = count% + 1
Print "Proccessing document # - " + Cstr(count%)
Print doc.fieldvalue1(0)
val$ = doc.fieldvalue1(0)
If (doc.HasItem ("fieldvalue2") And doc.fieldvalue2(0) <> "") Then
Call check(doc)
End If
If X = 10000 Then
Call SendMail( count% )
X = 1
End If
Set doc = view.GetNextDocument( doc )
X = X + 1
On Error Goto this
Wend

this:
Call errorlog.Opennoteslog(db.Server, "logdatabase.nsf")
errorlog.Logaction("Agent Started" + " at "& theTime$+ "Key is, "+ doc.fieldvalue1(0) +" created using form, "+ doc.Form(0) +" has doc id "+ doc.UniversalID + "for user - " + doc.eu_first_name(0) + " " +doc.eu_last_name(0)) 'begin logging
Call errorlog.Close
Print "Resume on error"
Resume Next
Exit Sub
End Sub


Sub check ( req As NotesDocument )
Dim view1 As NotesView
Dim dc As NotesDocumentCollection
Dim doc1 As NotesDocument
Dim item, item1, item2 As NotesItem
Dim db2 As NotesDatabase

Set db2 = New NotesDatabase( "IP ADDRESS", "db2.nsf" )
Set view1 = db2.GetView("ALL")
query$ = req.email(0)
j = view1.FTSearch(query$, 0 )
Set dc = view1.GetAllDocumentsByKey(req.fieldvalue1(0))
If ( dc.Count >= 3 ) Then
Set doc1 = dc.GetFirstDocument()
Set item2 = req.AppendItemValue("dbvalidemail", "No")
While Not(doc1 Is Nothing)
Set item = doc1.AppendItemValue("dbvalidemail", "No")
Set item1 = doc1.AppendItemValue("dbemailbounced", "Yes")
Call doc1.Save( False, True )
Call req.Save( False, True )
Set doc1 = dc.GetNextdocument(doc1)
Wend
Elseif ( dc.Count = 0 ) Then
Set item = req.AppendItemValue("dbvalidemail", "Yes")
Call req.Save( False, True )
End If
End Sub


Sub SendMail (Count As Integer )
Dim emaildb As NotesDatabase
Dim emaildoc As NotesDocument
Dim emailsession As New NotesSession
Set emaildb = emailsession.CurrentDatabase
Set emaildoc = New NotesDocument( emaildb )
emaildoc.Form = "Memo"
emaildoc.SendTo = "user's name"
emaildoc.Subject = "Agent Status Update - " & Cstr(Count)
Call emaildoc.Send( False )
End Sub

Thanks
MS






Agent performance (Manish Savla 26.Jul.05)
. . RE: Agent performance (Andre Guirard 26.Jul.05)
. . . . RE: Agent performance (Peter LaComb 26.Jul.05)
. . RE: Agent performance (Kenneth Axi 26.Jul.05)
. . . . RE: Agent performance (Charles E. Robi... 26.Jul.05)
. . . . RE: Agent performance (Manish Savla 26.Jul.05)
. . RE: Agent performance (Charles E. Robi... 26.Jul.05)
. . RE: Agent performance (Peter LaComb 26.Jul.05)
. . RE: Agent performance (Julie Kadashevi... 28.Jul.05)
. . RE: Agent performance (Heini Schwammer... 26.Jul.05)
. . . . RE: Agent performance (Manish Savla 27.Jul.05)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite