Solved

Agent needed to find & replace

Posted on 2002-07-17
7
193 Views
Last Modified: 2013-12-18
I have merged message/data from two different Domino DBs.

One DB form uses a field called title the other uses a field called subject, essentially the same info.

I need a manual agent takes the value from the title field and copies it to a newly create field call subject.  The field in question only has 1 value.


I already have another agent that will then delete the old title field.
0
Comment
Question by:jason_turner
[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
7 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 50 total points
ID: 7160327
Assuming Manually run agent on selected documents.

FIELD Subject := Title;
""

~Hemanth
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 7160330

Here is a sample set of code that may help.

It has some extras in it, that may not be needed.
-------------------------

Sub Initialize
    Dim session As New NotesSession
    Dim Doc As NotesDocument
    Dim InitialValue As Integer
    Dim item As NotesItem
    Dim NewNumber As Integer
    Dim Failures As Integer
    Dim OldNumber As Variant
    Dim x As Variant
    Dim Coll As notesdocumentcollection
    Dim dateTime As New NotesDateTime( "12/01/94" )  
    Dim success As Variant
    Dim Count As Integer
    Dim stringArray ( 1 To 9 ) As String
    Dim OldRSM, NewRSM As String
   
    Failures = 0
   
    Count = 0
    Set db = session.CurrentDatabase    
    Print("Searching...")
    Set Coll = db.Unprocesseddocuments
    Set Doc = Coll.getfirstdocument
   
    While Not doc Is Nothing        
         Count = Count + 1
         Print(Cstr(Count) + " of "+Cstr(Coll.Count)+"      "+Cstr(Round((Count/Coll.Count),1))+"%")
         
         doc.title= doc.subject
         Call Doc.Save(True,True)
         Set Doc = coll.getnextdocument(doc)
    Wend
    Print("Finished")
    Print("Found "+Cstr(Failures)+" failures")
End Sub
 
0
 
LVL 13

Expert Comment

by:CRAK
ID: 7160358
Create an agent runing on all documents in database, containing folowing code:

  Field Subject := @Trim(Subject:Title);
  Field Title := @Unavailable

This agent modifies EVERY document in the database; not only the ones holding "Title". Just to keep the code VERY short and plain!

It creates a list containing both "Subject" and "Title". Assuming one of them is empty @Trim removes the empty element from the list. The result is passed to "Subject".

The second line removes the "Title" from the document (if you want to use only one agent to do both).

You could test it on selected documents first to test different situations, if you run the agent on "selected documents" instead!
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!

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 7160534
Crak, read the question.. Jason already has another agent to take care of deleting fields.

Hello sys
0
 
LVL 1

Author Comment

by:jason_turner
ID: 7160586
Short, sweet and it works.

Thanks again. More easy ones to come.
0
 
LVL 13

Expert Comment

by:CRAK
ID: 7160622
Hemanthakumar,
Read the comment: "IF you want to use only one agent...."
Be honest about it: would you use a separate one?
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 7160656
Crak: Honestly, user wants it like that.

Jason thanks for the points.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

630 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