Solved

Challeging Question

Posted on 2000-02-17
9
178 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
Comment Utility
Is your search limited to the subject field, the body field, both or unknown?
0
 

Author Comment

by:Rajen
Comment Utility
Adjusted points to 100
0
 

Author Comment

by:Rajen
Comment Utility
HI,
Search is subjected to body field only

Regards
Rajen
0
 

Expert Comment

by:fayeb
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Accepted Solution

by:
Arunkumar earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Oops !  I guess you will have to include one more in declarations

Dim formula as String

-Arun
0
 

Author Comment

by:Rajen
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now