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

Agent needed to find & replace

Posted on 2002-07-17
7
190 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
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

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.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 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