Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Agent needed to find & replace

Posted on 2002-07-17
7
Medium Priority
?
195 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 200 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

916 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