Solved

Challeging Question

Posted on 2000-02-17
9
188 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
[X]
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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus Notes default email application problem 6 146
Lotus Notes Calendar Help 6 108
DIIOP IP Addresses Changes Automatically 5 116
How to get data off Lotus Notes server 4 77
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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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