Question

Agent neede

Asked by: hreinart

hi,

i have a notes database where new data is imported from time to time.
when the new records arrived in the database i look at it and see some
some of the imported data is not needed at all.
so i need to delete these records after the import.

the agent i need should delete redords where the field "name_of_the person" = xxx

xxx should be specified somewhere in the database so that i have a list like this
smith
miller
burton
...

all records where one of these words of this list appears should be deleted.

best would be that this agent runs in combitation with the import...if possible.

hope i defined it not too cmplicated.



i use notes r7 client, no server.


This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2007-01-30 at 09:07:57ID22142331
Topic

Lotus Notes

Participating Experts
2
Points
125
Comments
35

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Agent "If New Mail Arrives"
    I've created an agent, which should collect the posteddate and delivereddate from a new mail and write this information to a document in another database. I want to start this agent "If New Mail Arrives" on a server. I access the new mail with: Dim sess As New Not...
  2. agent needed
    i need an agent to do work on the following task: - a mail arrives in a maildatabase - it contains the information of: - the sender - the receiver - a pdf file in its body - the agents needs to detach the pdf file - then an external program converts it to a tif...
  3. after mail arrives agent
    Hi, I am trying to configure auto reply using after mail arrives, but nothing happens even after mail arrives.I found that auto reply works fine when using before mail arrives option,...can any one suggest how to go about it? Thanks in advance. AN
  4. Agent does not run "after new mail has arrived" R5
    I want to auto-FWD email to an external email account using an agent. I have the agent set to run "after new mail has arrived". When I test this agent it works fine, correctly identifies the new mail. But when I leave this agent to run on its own, it does not go....
  5. ODS Version of R7
    Does anybody have the ODS version number for R7. (Need some sort of reference for it as well) I would need an updated version of the administrators guide for R7 or admin help file for R7 in R5 format or PDF, if someone could link it to me. Thanks

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: SysExpertPosted on 2007-01-30 at 09:36:30ID: 18429389

Do you have the Designer client so that you can Create Lotus Script Agents ?

If yes, then please post the routine presently being used to import the data.

Then we can see if we can change that to ignore the records you do not want .

It should be possible to create a Profile or other Doc to hold the names you do not want.

I hope this helps !

 

by: hreinartPosted on 2007-01-31 at 00:34:44ID: 18434300

i use a .col file to import.
yes i have a designer client, too.

the file looks like this:

url: UNTIL ",";
product: UNTIL ",";
ip: UNTIL ",";
netname: UNTIL ",";
descr: UNTIL ",";
date: UNTIL ",";
time: UNTIL ",";
timestamp: UNTIL ",";
pers1_name: UNTIL ",";
pers1_address: UNTIL ",";
pers1_email: UNTIL ",";
pers1_phone: UNTIL ",";
pers1_fax: UNTIL ",";
pers2_name: UNTIL ",";
pers2_address: UNTIL ",";
pers2_email: UNTIL ",";
pers2_phone: UNTIL ",";
pers2_fax: UNTIL "";

 

by: madheeswarPosted on 2007-01-31 at 05:26:25ID: 18435547

http://www.experts-exchange.com/Applications/Email/Lotus_Notes_Domino/Q_10303354.html?query=import+from+text+file&topics=133
Sub Initialize
      Dim ss As New notessession
      Dim ws As New notesuiworkspace
      Dim db As notesdatabase
      Set db = ss.CurrentDatabase
      Dim doc As notesdocument
      Dim wholetxt As String
      Dim fileNum As Integer
      Dim counter As Integer
      Dim countRec As Integer
      
      On Error Goto Errorhandler
      
      fileNum% = Freefile()
      counter% = 0
'Prompt for Text File:
      files = ws.OpenFileDialog(True, "File List", _
      "", "c:")
      If Isempty(files) Then
            Exit Sub
      End If
      
'Specify the file
      'Open "c:\windows\desktop\import.txt" For Input As fileNum%
      Open files(0) For Input As fileNum%
      Do While Not Eof(fileNum%)
 ' Read each line of the file.
            Line Input #fileNum%, wholetxt$
            
            pos = Instr(1,wholetxt,"|")
            firsttxt = Left(wholetxt, pos -1)
            remtxt = Right(wholetxt , Len(wholetxt) - (Len(firsttxt) + 1))
            
            pos = Instr(1,remtxt,"|")
            secondtxt = Left(remtxt , pos-1)
            remtxt = Right(remtxt , Len(remtxt) - (Len(secondtxt) + 1))
            
            pos = Instr(1,remtxt,"|")
            thirdtxt = Left(remtxt , pos-1)
            remtxt = Right(remtxt , Len(remtxt) - (Len(thirdtxt) + 1))
            
' pos = pos = Instr(1,remtxt,",")
'            fourthtxt = remtxt
' remtxt = Right(remtxt , Len(remtxt) - (Len(fourthtxt) + 1))
            
            Print firsttxt & " " & secondtxt & " " & thirdtxt
            Set doc = db.CreateDocument
            doc.form = "MSN"
            doc.Category = firsttxt
            doc.Organization = secondtxt
            'doc.dobField = Cdat(Format(thirdtxt,"MM/DD/YYYY"))
            doc.SystemName = thirdtxt
            Call doc.Save(True,False)
            Delete doc
            
 ' Increment the line count.
            counter% = counter% + 1
      Loop
      
      Call ws.viewrefresh
Errorhandler:
      Print "Error" & Str(Err) & ": " & Error$ & " Error Line #: "& Erl
      Resume Next
End Sub

 

by: hreinartPosted on 2007-02-01 at 07:18:09ID: 18444686

hi madheeswar ,

thanks for this post.

i'm not a programmer but where could i see in the text to exclude or delete data records not wanted?

i need to specify that if a certain string appears in a specified field this record should be deleted.

does your code do this?

the import itsels works quite fine for me.

 

by: SysExpertPosted on 2007-02-05 at 11:38:30ID: 18470501

It will be much easier to do this after the import.

I'll see if I can post some code

 

by: hreinartPosted on 2007-02-06 at 00:21:25ID: 18474219

ok , i'll have a look at it and wait.
thanks

 

by: madheeswarPosted on 2007-02-06 at 01:39:21ID: 18474594

After this below line:
Do While Not Eof(fileNum%)
 ' Read each line of the file.
          Line Input #fileNum%, wholetxt$


You can have a If condition and step out of that record.

See below code with small changes..
Do While Not Eof(fileNum%)
 ' Read each line of the file.
          Line Input #fileNum%, wholetxt$
         
          pos = Instr(1,wholetxt,"|")
          firsttxt = Left(wholetxt, pos -1)
          remtxt = Right(wholetxt , Len(wholetxt) - (Len(firsttxt) + 1))
     
          pos = Instr(1,remtxt,"|")
          secondtxt = Left(remtxt , pos-1)
          remtxt = Right(remtxt , Len(remtxt) - (Len(secondtxt) + 1))
         
          pos = Instr(1,remtxt,"|")
          thirdtxt = Left(remtxt , pos-1)
          remtxt = Right(remtxt , Len(remtxt) - (Len(thirdtxt) + 1))
         
' pos = pos = Instr(1,remtxt,",")
'          fourthtxt = remtxt
' remtxt = Right(remtxt , Len(remtxt) - (Len(fourthtxt) + 1))
         
          Print firsttxt & " " & secondtxt & " " & thirdtxt
    if (remtxt <>"SomeText") then 'Exclude this record.
          Set doc = db.CreateDocument
          doc.form = "MSN"
          doc.Category = firsttxt
          doc.Organization = secondtxt
          'doc.dobField = Cdat(Format(thirdtxt,"MM/DD/YYYY"))
          doc.SystemName = thirdtxt
          Call doc.Save(True,False)
end if
         ' Delete doc
         
 ' Increment the line count.
          counter% = counter% + 1
     Loop

 

by: hreinartPosted on 2007-02-06 at 03:30:36ID: 18475110

madheeswar :

thanks for your code !!

sorry to ask this but ...
what does the code do (generally)?

what is the usage of this:
pos = Instr(1,wholetxt,"|")
          firsttxt = Left(wholetxt, pos -1)
          remtxt = Right(wholetxt , Len(wholetxt) - (Len(firsttxt) + 1))

and where can i store different text (found in the code 1 time : someText) to search for?

does your code import data?`



maybe my idea of it is not so realistic .... ?
i thought that it should be not a big deal to search documents in a nsf for some text and have these documents deleted.
...extend it to use a "storage" where diefferent text strings can be stored to look at.


i'm not a programer so i'm sorry if í ask something where you say:
big deal / too much work to do it.....

 

by: madheeswarPosted on 2007-02-06 at 05:05:24ID: 18475662


Option Public
Sub initialize
 Dim s As New NotesSession
 Dim mbox As NotesDatabase
 Dim dc As NotesDocumentCollection
 
  '>>Define search fomula
 sstring$ = "SELECT FORM = ""YourFormName"" & "Your text String""  'U can use Input box for getting test string from the user
 '>>Loop through all databases and remove documents based on the search formula
   Set mbox = s.currentDatabase
 If mbox.isopen Then
 Set dc = mbox.Search(sstring$, Nothing, 0)
 Print "Found " & dc.count & " documents to delete in " & mbox.filename
 Call dc.RemoveAll(True)
 Else
 Print "Unable to open database " & Cstr(d)
 End If
 
End Sub

 

by: hreinartPosted on 2007-02-06 at 06:04:52ID: 18476060

i did not test it yet but instead of entering the strings allways again and again
could something work like this:

"Your text String""   & "Your text String1""   & "Your text String2""  & "Your text String3""  ....


when importing the data the incomming data is allways mixed with data i don't want.
this means that i need to delete allways the same kind of data (where e.g. name=smith & name=miller)....

thanks
hreinart

 

by: SysExpertPosted on 2007-02-06 at 14:49:30ID: 18480505

Untested but should work.

Create an agent  for Lotus Script in the DB that has the recoreds you want deleted. From menu, acts on all documents.

You need to substitute your values for

delNames list
and in
If Iselement(Delnames(doctocheck.name_of_the_person(0))) Then      

you need to plug in the name of the field where the peoples names are located.

copy and paste the declarations into the declarations section,
make sure option explicit is set

copy the initialize section and the second sub.
You can add error handling via Msgbox for now.

Declarations

      Dim db As NotesDatabase
      Dim inbox As notesview
Dim DELNames List As Integer
Dim server As String ,  mailpath As String ' server name and path to DB
Dim cutoffdate As NotesDateTime
' Dim DATABASE As NotesDatabase
Dim totaldeleted As Double, TotalDBSize As Double
Dim Dbg2 As Integer
Dim Dbg As Integer
Dim Dbg4 As Integer ' end count
Dim DbgEnd As Integer ' end early
Dim formname As String
Dim  servername As String
Dim Temp1 As Variant ' For checking if Field exists - flag or boolean
Dim DocCnt As Long , DocCntTot As Long  ' Documnet count

Sub Initialize
      
      Dim s As notesSession
      Dim db As NotesDatabase
      Dim inbox As notesview
      
      Set s=New notesSession
      
      Set db = s.currentDatabase
      servername=db.server
'
      Dim dbase As NotesDatabase
      Dim dbdirectory As New NotesDBDirectory (servername)
      Dim Nview As notesview
      
      Dim sDBpath As String  ' just path of DB being pocessed
      Dim nConfig As NotesDocument
      Dim Mycnt As Integer, CntL As Integer
      
'      Set agentLog =New  NotesLog("Clean Mail-D2-30" )
'      agentLog.logactions =1 ' set to True , 0 = false ?
      
      Dim Dirstr1 As String  ' For mail Dirs to Delete
      
      
      delNames("Joe Shmo") = 1
      delNames("Sam Smith") = 2
'      delNames("Sam Smith") = 3
'      delNames("Sam Smith") = 4 - as many names as you need
      
      
      Dbg2=2   ' for detailed debugging MR V 0.92
      Dbg=0   ' for detailed debugging MR V 0.927 E - Details in Process MailFile
      Dbg4=0   ' for detailed debugging MR V 0.92
      DbgEnd =0
      
      TotalDBSize=0
      totaldeleted = 0 ' start of total
      
      
      ' Add check for if file exists, append up til 1 MB size, then rename and create another
      
      
'      End If
      
                         ' MR 0.97 H list rather than string
      Call ProcessMailFile (dbase)
      
      '      Set dbase = dbdirectory.GetNextDatabase
      
      
      If totaldeleted = 0 Then
'
'            Call agentLog.LogAction("Cleanup Complete, 0 Bytes recovered")
      Else
            
      '      Call agentLog.LogAction("Cleanup Complete;Total space recovered;" & Format$(totaldeleted, "###,###,###,###") & "; Bytes recovered out of ;"& Format$(TotalDBSize, "###,###,###,###"))
      End If
'      Call agentLog.close
      
      
End Sub

Sub ProcessMailFile ( indb As notesdatabase)
      
      Dim deleted As Long, age As Long 'Dim deletedsize As Double
      Dim deletesize As Double
      
      Dim s As New notesSession
      
      Set Indb = s.currentDatabase
' server=db.server
      
'      mailpath="pathtoDB"
      
      Dim doctocheck As notesdocument
      Dim nextdoc As notesdocument
'      Dim collection As notesdocumentcollection
'      Set cutoffdate = New NotesDateTime( "Today" )
      
'      Set InDb = S.GetDatabase(server, mailpath)
      
      deleted = 0 'deletedsize = 0
      DocCnt =0
      DbgEnd =0  ' end after 4 errors at lowest level
      deletesize =0 ' set per DB
      
      
      On Error Goto PMFErrHandler
      
'      If Dbg2 > 0 Then Call agentLog.LogAction("P1 " & ","  & indb.Title & ","  & indb.filepath)
      
      Call indb.Open( "", "" )  ' already instantiated in external loop, so pass empty strings
'      If Dbg2 > 0 Then Call agentLog.LogAction("P2" & ","  & indb.Title & ","  & indb.filepath)
      TotalDBSize=indb.size+TotalDBSize ' MR 0.97G
'***check inbox or all
'      If Dbg2 >1 Then
      Set inbox =indb.GetView("Yourview")  '  Put your viewname here
      
      Set doctocheck = inbox.getfirstdocument
      
      While Not ( doctocheck Is Nothing )
            
            DocCnt =DocCnt +1
            If Iselement(Delnames(doctocheck.name_of_the_person(0))) Then      
                  
                  deletesize =deletesize +doctocheck.size
                  totaldeleted = totaldeleted + doctocheck.size 'total for all databases
                  Set nextdoc = inbox.GetNextDocument( doctocheck ) 'need to get next doc before doctocheck is deleted, otherwise errors
      '            If Dbg =0 Then ' MR V 0.9 debug mode checks only - no delete
                  Call doctocheck.remove(False)
                  Set doctocheck = nextdoc
      '            Else ' MR V 0.97  - get next Doc
      '                  Set doctocheck = nextdoc
      '            End If
                  deleted = deleted + 1
      '      Else
                  Set doctocheck = inbox.GetNextDocument( doctocheck )
      '      End If
'      Else ' skip to next doc or delete
'            Set doctocheck = inbox.GetNextDocument( doctocheck )
            End If
            
      Wend
      
      Goto normal
      
PMFErrHandler:
      On Error Goto 0
      ' Call logaction("Error processing " & indb.Title , Err, Error$, "Error")
' Call agentLog.LogError(Err,"Error processing " & ","  & indb.Title & ","  & indb.filepath & "," & Error$ & " on line," & Trim$(Str$(Erl)) )
      Exit Sub

 

by: hreinartPosted on 2007-02-08 at 05:18:04ID: 18493263

hi,

i'm just trying it.
2 problems i have.

1)
what exactly do i need to do here?
make sure option explicit is set


2)
Goto normal
an error occures: undefined label.


could you please have a look at it?



thanks
hreinart

 

by: hreinartPosted on 2007-02-08 at 05:27:49ID: 18493329

i tried to remark the line Goto normal

now i can save it but when i run it nothing happens.

 

by: SysExpertPosted on 2007-02-08 at 06:39:24ID: 18493891

Did you change the info for your view and add the peoples names.

Please post your code.

 

by: hreinartPosted on 2007-02-08 at 06:54:57ID: 18494041

i did this:
delNames list
and in
If Iselement(Delnames(doctocheck.name_of_the_person(0))) Then    

could i send the nsf to you?


===============================================
Dim db As NotesDatabase
Dim inbox As notesview
Dim DELNames List As Integer
Dim server As String ,  mailpath As String ' server name and path to DB
Dim cutoffdate As NotesDateTime
' Dim DATABASE As NotesDatabase
Dim totaldeleted As Double, TotalDBSize As Double
Dim Dbg2 As Integer
Dim Dbg As Integer
Dim Dbg4 As Integer ' end count
Dim DbgEnd As Integer ' end early
Dim formname As String
Dim  servername As String
Dim Temp1 As Variant ' For checking if Field exists - flag or boolean
Dim DocCnt As Long , DocCntTot As Long  ' Documnet count





Sub Initialize
      Dim s As notesSession
      Dim db As NotesDatabase
      Dim inbox As notesview
      
      Set s=New notesSession
      
      Set db = s.currentDatabase
      servername=db.server
'
      Dim dbase As NotesDatabase
      Dim dbdirectory As New NotesDBDirectory (servername)
      Dim Nview As notesview
      
      Dim sDBpath As String  ' just path of DB being pocessed
      Dim nConfig As NotesDocument
      Dim Mycnt As Integer, CntL As Integer
      
'     Set agentLog =New  NotesLog("Clean Mail-D2-30" )
'     agentLog.logactions =1 ' set to True , 0 = false ?
      
      Dim Dirstr1 As String  ' For mail Dirs to Delete
      
      
      delNames("Daniel Budzyn") = 1
      delNames("Sam Smith") = 2
'     delNames("Sam Smith") = 3
'     delNames("Sam Smith") = 4 - as many names as you need
      
      
      Dbg2=2   ' for detailed debugging MR V 0.92
      Dbg=0   ' for detailed debugging MR V 0.927 E - Details in Process MailFile
      Dbg4=0   ' for detailed debugging MR V 0.92
      DbgEnd =0
      
      TotalDBSize=0
      totaldeleted = 0 ' start of total
      
      
     ' Add check for if file exists, append up til 1 MB size, then rename and create another
      
      
'     End If
      
                     ' MR 0.97 H list rather than string
      Call ProcessMailFile (dbase)
      
     '     Set dbase = dbdirectory.GetNextDatabase
      
      
      If totaldeleted = 0 Then
'
'          Call agentLog.LogAction("Cleanup Complete, 0 Bytes recovered")
      Else
            
     '     Call agentLog.LogAction("Cleanup Complete;Total space recovered;" & Format$(totaldeleted, "###,###,###,###") & "; Bytes recovered out of ;"& Format$(TotalDBSize, "###,###,###,###"))
      End If
'     Call agentLog.close
      
      
      
End Sub













Sub ProcessMailFile ( indb As notesdatabase)
      
      Dim deleted As Long, age As Long 'Dim deletedsize As Double
      Dim deletesize As Double
      
      Dim s As New notesSession
      
      Set Indb = s.currentDatabase
' server=db.server
      
'     mailpath="pathtoDB"
      
      Dim doctocheck As notesdocument
      Dim nextdoc As notesdocument
'     Dim collection As notesdocumentcollection
'     Set cutoffdate = New NotesDateTime( "Today" )
      
'     Set InDb = S.GetDatabase(server, mailpath)
      
      deleted = 0 'deletedsize = 0
      DocCnt =0
      DbgEnd =0  ' end after 4 errors at lowest level
      deletesize =0 ' set per DB
      
      
      On Error Goto PMFErrHandler
      
'     If Dbg2 > 0 Then Call agentLog.LogAction("P1 " & ","  & indb.Title & ","  & indb.filepath)
      
      Call indb.Open( "", "" )  ' already instantiated in external loop, so pass empty strings
'     If Dbg2 > 0 Then Call agentLog.LogAction("P2" & ","  & indb.Title & ","  & indb.filepath)
      TotalDBSize=indb.size+TotalDBSize ' MR 0.97G
'***check inbox or all
'     If Dbg2 >1 Then
      Set inbox =indb.GetView("Yourview")  '  Put your viewname here
      
      Set doctocheck = inbox.getfirstdocument
      
      While Not ( doctocheck Is Nothing )
            
            DocCnt =DocCnt +1
            If Iselement(Delnames(doctocheck.pers1_name(0))) Then    
                  
                  deletesize =deletesize +doctocheck.size
                  totaldeleted = totaldeleted + doctocheck.size 'total for all databases
                  Set nextdoc = inbox.GetNextDocument( doctocheck ) 'need to get next doc before doctocheck is deleted, otherwise errors
     '          If Dbg =0 Then ' MR V 0.9 debug mode checks only - no delete
                  Call doctocheck.remove(False)
                  Set doctocheck = nextdoc
     '          Else ' MR V 0.97  - get next Doc
     '               Set doctocheck = nextdoc
     '          End If
                  deleted = deleted + 1
     '     Else
                  Set doctocheck = inbox.GetNextDocument( doctocheck )
     '     End If
'     Else ' skip to next doc or delete
'          Set doctocheck = inbox.GetNextDocument( doctocheck )
            End If
            
      Wend
      
      ' Goto normal
      
PMFErrHandler:
      On Error Goto 0
     ' Call logaction("Error processing " & indb.Title , Err, Error$, "Error")
' Call agentLog.LogError(Err,"Error processing " & ","  & indb.Title & ","  & indb.filepath & "," & Error$ & " on line," & Trim$(Str$(Erl)) )
      Exit Sub
      
End Sub



 

by: hreinartPosted on 2007-02-08 at 07:01:46ID: 18494108

ok, found the view:

Set inbox =indb.GetView("By Customer")  '  Put your viewname here


.. but does still do not delete...

 

by: SysExpertPosted on 2007-02-08 at 10:13:00ID: 18495796

post a zipped test DB on the ee-files site

http://www.ee-stuff.com

and post the link here.

 

by: hreinartPosted on 2007-02-14 at 02:35:05ID: 18530025

i was ill, sorry.
will upload now.

 

by: hreinartPosted on 2007-02-14 at 02:40:58ID: 18530043

when looking at the nsf, please e.g. try to delete with the agent

all records where pers1_name = ""Daniel Budzyn""

 

by: hreinartPosted on 2007-02-14 at 03:02:17ID: 18530123

i uploaded it, but no infpormation about success or no-success was displayed.
please have a look and see if you can find the file.

 

by: hreinartPosted on 2007-02-14 at 03:07:36ID: 18530143

 

by: SysExpertPosted on 2007-02-14 at 08:53:19ID: 18532857

OK, I hope to look at this tomorrow.

 

by: hreinartPosted on 2007-02-27 at 03:50:37ID: 18616030

hi,

please give me a hint when you had a chance to look at.
thanks

 

by: SysExpertPosted on 2007-03-01 at 08:44:15ID: 18633716

Sorry. things have been crazy witht he DST updates.

I hope to do so soon.

 

by: hreinartPosted on 2007-03-02 at 09:18:45ID: 18642551

ok, thanks

 

by: hreinartPosted on 2007-03-12 at 01:28:40ID: 18700422

hi,

you're still on this topic?

 

by: SysExpertPosted on 2007-03-12 at 18:24:01ID: 18707068

Yes, almost done with DST issues.

 

by: hreinartPosted on 2007-03-21 at 11:01:20ID: 18765977

still here?

 

by: SysExpertPosted on 2007-03-21 at 11:35:01ID: 18766174

Looking at it now.

 

by: SysExpertPosted on 2007-03-21 at 12:31:16ID: 18766555

Ok corrected and tested.

fixed else in delete loop, and your names already include Quotes, so I had to fix that also.

Enjoy !


Option Public
Option Explicit

Declarations

Dim db As NotesDatabase
Dim inbox As notesview
Dim DELNames List As Integer
Dim server As String ,  mailpath As String ' server name and path to DB
Dim cutoffdate As NotesDateTime
' Dim DATABASE As NotesDatabase
Dim totaldeleted As Double, TotalDBSize As Double
Dim Dbg2 As Integer
Dim Dbg As Integer
Dim Dbg4 As Integer ' end count
Dim DbgEnd As Integer ' end early
Dim formname As String
Dim  servername As String
Dim Temp1 As Variant ' For checking if Field exists - flag or boolean
Dim DocCnt As Long , DocCntTot As Long  ' Documnet count


Sub Initialize
      Dim s As notesSession
      Dim db As NotesDatabase
      Dim inbox As notesview
      
      Set s=New notesSession
      
      Set db = s.currentDatabase
      servername=db.server
'
      Dim dbase As NotesDatabase
      Dim dbdirectory As New NotesDBDirectory (servername)
      Dim Nview As notesview
      
      Dim sDBpath As String  ' just path of DB being pocessed
      Dim nConfig As NotesDocument
      Dim Mycnt As Integer, CntL As Integer
      
'     Set agentLog =New  NotesLog("Clean Mail-D2-30" )
'     agentLog.logactions =1 ' set to True , 0 = false ?
      
      Dim Dirstr1 As String  ' For mail Dirs to Delete
      
      
      delNames({"Daniel Budzyn"}) = 1
      delNames({"Sam Smith"}) = 2
'     delNames("Sam Smith") = 3
'     delNames("Sam Smith") = 4 - as many names as you need
      
      
      Dbg2=2   ' for detailed debugging MR V 0.92
      Dbg=0   ' for detailed debugging MR V 0.927 E - Details in Process MailFile
      Dbg4=0   ' for detailed debugging MR V 0.92
      DbgEnd =0
      
      TotalDBSize=0
      totaldeleted = 0 ' start of total
      
      
     ' Add check for if file exists, append up til 1 MB size, then rename and create another
      
      
'     End If
      
                     ' MR 0.97 H list rather than string
      Call ProcessMailFile (dbase)
      
     '     Set dbase = dbdirectory.GetNextDatabase
      
      
      If totaldeleted = 0 Then
'
'          Call agentLog.LogAction("Cleanup Complete, 0 Bytes recovered")
      Else
            
     '     Call agentLog.LogAction("Cleanup Complete;Total space recovered;" & Format$(totaldeleted, "###,###,###,###") & "; Bytes recovered out of ;"& Format$(TotalDBSize, "###,###,###,###"))
      End If
'     Call agentLog.close
      
      
      
End Sub

Sub ProcessMailFile ( indb As notesdatabase)
      
      Dim deleted As Long, age As Long 'Dim deletedsize As Double
      Dim deletesize As Double
      
      Dim s As New notesSession
      
      Set Indb = s.currentDatabase
' server=db.server
      
'     mailpath="pathtoDB"
      
      Dim doctocheck As notesdocument
      Dim nextdoc As notesdocument
'     Dim collection As notesdocumentcollection
'     Set cutoffdate = New NotesDateTime( "Today" )
      
'     Set InDb = S.GetDatabase(server, mailpath)
      
      deleted = 0 'deletedsize = 0
      DocCnt =0
      DbgEnd =0  ' end after 4 errors at lowest level
      deletesize =0 ' set per DB
      
      
      On Error Goto PMFErrHandler
      
'     If Dbg2 > 0 Then Call agentLog.LogAction("P1 " & ","  & indb.Title & ","  & indb.filepath)
      
'      Call indb.Open( "", "" )  ' already instantiated in external loop, so pass empty strings
'     If Dbg2 > 0 Then Call agentLog.LogAction("P2" & ","  & indb.Title & ","  & indb.filepath)
'      TotalDBSize=indb.size+TotalDBSize ' MR 0.97G
'***check inbox or all
'     If Dbg2 >1 Then
      Set inbox =indb.GetView("Import")  '  Put your viewname here
      
      Set doctocheck = inbox.getfirstdocument
      
      While Not ( doctocheck Is Nothing )
            formname=  doctocheck.pers1_name(0)
            DocCnt =DocCnt +1
            If Iselement(Delnames(doctocheck.pers1_name(0))) Then    
      '            Msgbox doctocheck.pers1_name(0)
                  
                  totaldeleted = totaldeleted + 1 'total for all databases
                  Print totaldeleted
                  Set nextdoc = inbox.GetNextDocument( doctocheck ) 'need to get next doc before doctocheck is deleted, otherwise errors
     '          If Dbg =0 Then ' MR V 0.9 debug mode checks only - no delete
                  Call doctocheck.remove(False)
                  Set doctocheck = nextdoc
     '          Else ' MR V 0.97  - get next Doc
     '               Set doctocheck = nextdoc
     '          End If
                  deleted = deleted + 1
            Else
                  Set doctocheck = inbox.GetNextDocument( doctocheck )
     '     End If
'     Else ' skip to next doc or delete
'          Set doctocheck = inbox.GetNextDocument( doctocheck )
            End If
            
      Wend
      
      Exit Sub
      
PMFErrHandler:
      On Error Goto 0
     ' Call logaction("Error processing " & indb.Title , Err, Error$, "Error")
      Print "error in Delete"
' Call agentLog.LogError(Err,"Error processing " & ","  & indb.Title & ","  & indb.filepath & "," & Error$ & " on line," & Trim$(Str$(Erl)) )
      Exit Sub
      
End Sub

 

by: hreinartPosted on 2007-03-23 at 05:31:42ID: 18779043

hi,

i tested the agent.
thanks a lot for your work !!!

generally it works fine.
it is strange that some data records are not deleted (maybe not found) .
all the names which you can see in the field are listed here (see below).

the agent should recognize and find them.

any idea what happens here?
do i need to modify anything else, too?

this is the code for finding the names:

delNames({"Daniel Budzyn"}) = 1
      delNames({"Security Team"}) = 2
      delNames("Stefan Feurle") = 3
      delNames("Torsten Vinke") = 4
      delNames("Rene Schulze") = 5
      delNames("Patrice Bertin") = 6
      delNames("Fred Mattig") = 7
      delNames("Claus Reinel") = 8
      delNames("NoValue") = 9
      delNames("AOL NOC") = 10
      delNames("Michel van der Laan") = 11
      delNames("Bernd Ahrens") = 12
      delNames("Bernhard Pege") = 13
      delNames("Fred Mattig") = 14
      delNames("Joerg Vierke") = 15
      delNames("Wilhelm Boeddinghaus") = 16
      delNames("mediaWays abuse") = 17
      delNames("pers1_name") = 18
      delNames("Net Pub") = 19
      delNames("Dominique Fillon") = 20
      delNames("Torsten Vinke") = 21
      '       delNames("pers1_name") =
      '       delNames("pers1_name") =
      '       delNames("pers1_name") =
      '       delNames("pers1_name") =
     '       delNames("pers1_name") =
      '       delNames("pers1_name") =


name #10 (AOL) is not found.

in the end the agend does about 80% of the work.
so if it's not a big deal please have a look at it.
if you need to invest a lot of time, don't do it.


thanks again
harald

 

by: SysExpertPosted on 2007-03-23 at 06:56:08ID: 18779690

For now the names must be an exact match, including case.
You might want to consider putting the delnames list all in upper case and changing the original  line to

If Iselement(Delnames(Ucase(doctocheck.pers1_name(0)))) Then  

I hope this helps !

 

by: hreinartPosted on 2007-03-23 at 09:52:33ID: 18781268

this is how i create these names:

i open a document which i like to have deleted by the agent.
then i copy the contnent of the field names1 and paste it to the nameslist in the agent code.

using upper case would mean that the names in the documents need to be written in uppercase, too ?
if yes, i can't do this. there are too many documents which i'd need to modify.

i'm not good at reading the agent, but could it also work like this:
i write the delnames in uppercase
the agent browses through the database and loooks for:
if uppercase(name1) = delname (which is written in uppercase) then delete.


also:
do i need a special view to run the agent correctly?
or do i need to sort a column?

the agent runs only if i mark 1 document.



thanks
harald

 

by: SysExpertPosted on 2007-03-23 at 13:36:27ID: 18783021

It will work on all docs in the Import view.

You can start in any view, but  you need 1 selected doc.

We can change the code to make all the delnames upper case f needed.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...