Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Challeging Question

Posted on 2000-02-17
9
184 Views
Last Modified: 2013-12-18
Hi,
 I have a requirement where in I have to search documents in Inbox folder of a persons mail file and look for the text category= and based on the value say category=others the agent should put the document in others folder. Can anyone let me know how to do this. I appreciate if one can send a sample code for this

Regards
Rajen
0
Comment
Question by:Rajen
9 Comments
 
LVL 1

Expert Comment

by:rfharris
ID: 2533131
Is your search limited to the subject field, the body field, both or unknown?
0
 

Author Comment

by:Rajen
ID: 2533368
Adjusted points to 100
0
 

Author Comment

by:Rajen
ID: 2533375
HI,
Search is subjected to body field only

Regards
Rajen
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Expert Comment

by:fayeb
ID: 2534321
If you look in you notes templates there is one called Search in here you can configure the database to search a specific database for a specific word
0
 
LVL 9

Accepted Solution

by:
Arunkumar earned 100 total points
ID: 2534452
Hi Rajen !!!

Here is the code.  You may put this in an agent.  And run it from actions menu.

======================================
Dim dc as notesdocumentcollection
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim ss as new notessession
Set db = ss.CurentDatabase
Dim view as notesview
Set view = db.GetView("($Inbox)")

formula = |FIELD Body Contains "category=others" |

Set dc = view.FTSearch(formula , 0 )

If dc.Count = 0 then
msgbox "No documents found for category = others"
Else
Print "Found " & dc.count & " documents for category=others"
Call dc.PutAllInFolder("Others")
End If
=======================================

Good Luck !!!

-Arun

PS:Dont schedule this agent since session class in included in this.
0
 

Author Comment

by:Rajen
ID: 2535800
Hi Arun,
How are u. Hope u remember me.You are from chennai and presently at New York na.Thanks for the code, but the thing is the category might be different ie not only others but also some other vlue say"marketting" etc. In such case how will u extract this value alone in order to put the document in that category

Rajen
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 2538036
Hi Rajen,

You got a terrific memory.  I was in NY till Dec.99 Then moved to MI(michigan)
Working for DaimlerChrysler (a car manufacturing co.)

Coming to your code. Try the following.

======================================
Dim dc as notesdocumentcollection
Dim db As NotesDatabase
Dim ss as new notessession
Dim doc as notesdocument
Set db = ss.CurrentDatabase
Dim view as notesview
Set view = db.GetView("($Inbox)")

txt = InputBox$("What category you want to search ?")

 formula = |FIELD Body Contains category= "| & txt & |"|

j = view.FTSearch(formula , 0 )

For i = 1 To j
  Set doc = view.GetNthDocument( i )
  Call doc.PutInFolder( txt )
Next

If j = 0 then
msgbox "No documents found for selected category"
Else
Print "Found " & j & " documents for specified category"
End If
=======================================
Good Luck !

-Arun

PS1:  This code will create new folders byitself if you dont have that category of search.
PS2: I did not have time to debug this code.  Feel free to contact me if you have any issues.

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 2538039
Oops !  I guess you will have to include one more in declarations

Dim formula as String

-Arun
0
 

Author Comment

by:Rajen
ID: 2539995
Hi Arun,
Let me thankyou for the code. I will test your code also. I have also written a code for this. But here iam replacing newline with #. But if the category value is going to be in the last line it will not replace. Any suggestion. I will try ur code also. Thanks

Rajen


Sub Initialize
     Dim sess As New NotesSession    
     Dim db As notesDatabase
     Dim coll As NotesDocumentCollection
     Dim seldoc As NotesDocument
     Set db = sess.CurrentDatabase
     Set coll = db.UnprocessedDocuments
     For i = 1 To coll.count
          Set newdoc = New NotesDocument(db)          
          Set Seldoc = coll.GetnthDocument(i)
          Dim rtitem As NotesRichTextitem
          Set rtitem = seldoc.GetFirstitem("Body")
          tmp = rtitem.getFormattedText(True,0)
          Newdoc.Fld1=tmp
          Flag="Tmp"          
          Newdoc.Fld2 = Evaluate(| @ReplaceSubstring(Fld1;@NewLine;"#")|, newdoc)
         
DoProcess:                              
          Fromvalue = Evaluate(| @Middle(Fld2;"Category = ";"#") |,Newdoc)
          newfolder$=fromvalue(0)
          Call seldoc.PutInFolder( newfolder$ )
          If Flag(0) = "" Then
               
               Goto Exit_fn
          Else
               Goto DoProcess
          End If
         
Exit_fn:                  
     Next
     Msgbox fromvalue(0)
          'Msgbox Fromvalue(0)
End Sub
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Domino Server 11 72
Adding a named anchor in a Lotus Notes Form 6 99
Using @Prompt in a Queryclose Event 14 84
Domino 8 run a specific agent on all nsf in a folder 9 63
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 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