Solved

Agent needed to find & replace

Posted on 2002-07-17
7
187 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

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
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
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.

708 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

13 Experts available now in Live!

Get 1:1 Help Now