×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Modified Code - Attn: Pmonett

Modified Code - Attn: Pmonett

Modified Code - Attn: Pmonett

(OP)
Pascal,

i've sent you two emails regarding this and haven't heard back from you.  So, I'm posting here.


Just following up to see if you got this - thinking you might be vacationing somewhere.

les

----- Forwarded by Leslie Andrews/Information Technology/MetCt on 08/09/2005 08:15 AM -----
Leslie Andrews/Information Technology/MetCt
08/02/2005 09:21 AM    
To
Pascal Monett
cc

Subject
Notes error
    

    

I have a problem.  I created a process in the Leave Accounting system we use to find specific documents for certain people in our organization.  The top administrators (who all work in the Administration Division and have a "Personal Rank" of 4 or 5) have to approve leave for various divisions within the court.  However, the views in the leave system are all driven by the department you work in.  

So, when I go into the system, it finds that my department is "Information Technology", so when I press the "Pending Leave" button, it opens the "Information Technology Pending Leave" view.  So, when the "Pending Leave" button is selected by someone who is assigned to Adminstration and has a Personal Rank greater than 4, my "new" process is run.  

This process searches for documents from the past 6 months that are still pending and has the current user as the value in the "Next Approver" field.  If a document is found it is placed in a folder which is then opened in a view.  However, each administrator uses the same 'Admin' folder, so before I add new documents, I have to empty the folder.  This process consistently returns a 'Network Timeout' error.  I modified the process a while back to only empty the folder if it had stuff in it and it continually tries to empty even if it is and then still times out.

I don't know what else to try!!  Here's the relevant code, if you could look it over and give me any suggestions for improvement, I would appreciate it.  

ps - I didn't design this system and only have to take care of it by default (I wrote most of the other Lotus Notes applications used in the court!).

Thanks!

les

Here's the script for the button on the navigator:

CODE

Sub Click(Source As Navigator)
 
 Dim ws As New NotesUIWorkspace
 Dim uidb As NotesUIDatabase
 Dim leavedb As NotesDatabase
 Dim collection As NotesDocumentCollection
 Set uidb = ws.CurrentDatabase
 Set leavedb = ws.CurrentDatabase.Database
 
 Dim doc As NotesDocument
 
 Dim session As New NotesSession
 Dim maildb As NotesDatabase
 Dim mailview As NotesView
 Dim UserName As String
 
 Dim dateTime As New NotesDateTime( Today )
 Call dateTime.AdjustMonth (-6)
 
 Stop
 
 Set maildb = New NotesDatabase( "Domino1", "names.nsf" )
 Set mailview = maildb.GetView( "People" )
 
 UserName = Strrightback(session.CommonUserName," ")+" , "+Strleft(session.CommonUserName," ")
 
 
 Set doc = mailview.GetDocumentByKey(UserName)
 
 
 
 If doc.Department(0) <> "Administration"  Then
  Call ws.SetTargetFrame("ViewFrame")
  Call uidb.OpenView(doc.Department(0) + " PendingLeave")
 Else
  If Cdbl(doc.PersonalID(0)) >= 4 Then
   
   searchFormula$ = "(Form = ""Leave"" | Form = ""Leave Request"" | Form = ""Vacation"") & NextApprover = """ + session.CommonUserName + """ & (@Contains(Status; ""Pending"") | @Contains(Status; ""Tentative""))"
   Stop
   
   
   Set collection = leavedb.Search(searchFormula$,datetime,0)
   
   If collection.Count > 0 Then
    EmptyAdminFolder
    
    Call collection.PutAllInFolder("AdminCollection")
    Call ws.SetTargetFrame("ViewFrame")
    Call uidb.OpenView("AdminCollection")
   Else
    Messagebox "You have no pending leave to approve.", MB_OK, "Pending Leave"
   End If
   
   
  Elseif Cdbl(doc.PersonalID(0)) > 0 Then
   Call ws.SetTargetFrame("ViewFrame")
   Call uidb.OpenView(doc.Department(0) + " PendingLeave")'
  End If
  
  
  
  
  
 End If
 
 
 
 
End Sub
and here's the script for the EmptyAdminFolder function:

CODE

Sub EmptyAdminFolder
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim folder As NotesView
 Dim collection As NotesDocumentCollection
 
 Set db = session.CurrentDatabase
 Set folder = db.GetView("AdminCollection")
 
 'this runs even if the folder is empty!
 If Not Isempty(folder) Then
  Set collection = db.AllDocuments
  Call collection.RemoveAllFromFolder( "AdminCollection" )
 End If
End Sub
thanks!

me

RE: Modified Code - Attn: Pmonett

Hi Les,

I see that one cannot escape a determined woman, hmm ,-) ?

I did get your mails, I'm just a bit occupied at the moment. I do have to improve my writing efficiency, though.

Anyway, I have been looking into the network issue. That is kind of hard to debug remotely.
Where I work, we have been having problems where the server hangs for no apparent reason. It has been going on for months, but lately our admin got a call from a user that the user could not open the mail.
It turns out that the user's mail file was locked by a process that had "opened" it locally - and that cannot be anything but the backup application.
When we noticed that, we worked on monitoring file access and we found that the backup app, for some reason, locks one file at random and does not give it back.
When it locks the notes.ini, or the names.nsf, the server cannot continue and hangs.
I never would have thought a backup app could be so stupid. We found some parameters and managed, apparently, to stop this behavior. Time will tell, but it's looking better at the moment.
So you see, a network timeout is really an unfortunate bug. I don't think that your code is the problem, but I have yet to test it on our dev server.
I do think that you could modify your EmptyAdminFolder though. IsEmpty does not always test what we think it does - it works pretty well for NotesItem, but I would be wary of extending that to a NotesView object.

I would suggest doing this :

CODE

Sub EmptyAdminFolder
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim folder As NotesView
 Dim collection As NotesDocumentCollection
 Dim doc as notesdocument
 
 Set db = session.CurrentDatabase
 Set folder = db.GetView("AdminCollection")
 Set doc = folder.getfirstdocument
 If Not(doc Is Nothing) Then
  Set collection = db.AllDocuments
  Call collection.RemoveAllFromFolder( "AdminCollection" )
 End If
End Sub
That way, you get the first doc in the folder and, if there is one, you empty it.

I'll continue looking for something else to do.

Pascal.

RE: Modified Code - Attn: Pmonett

(OP)
Well, you're usually so good about answering mail, that I assumed it was lost in cyberspace somewhere between here & there!  Wasn't trying to be pushy, but the Court Administrator is the force behind this improvement, since he's the one it affects!

I appreciate your help and I'll try out the new Empty code.

The network timeout error is very frustrating!!

les

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close