Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modified Code - Attn: Pmonett

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
0
0
US
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
    [COLOR=red]EmptyAdminFolder[/color]
    
    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")
 
 [COLOR=green]'this runs even if the folder is empty![/color]
 [b]If Not Isempty(folder) Then[/b]
  Set collection = db.AllDocuments
  Call collection.RemoveAllFromFolder( "AdminCollection" )
 End If
End Sub
thanks!

me
 
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.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top