Changes Prefix/First Couple Letters of a Field to a Different Prefix Code

Author: Tripp W Black

Created: 03/19/2001 at 02:55 PM

 

Category:
Notes Developer Tips
LotusScript, Agents

The agent is setup to run on selected docs within a view.

Revertes the BillTypingname_LMS in Bill Drafts back to the DR format.
(Code below in case you were curious.)

I also ran the agent in Modifications in the All Bill Typing view to
change the names to the PCS format.


Sub Initialize

Dim Session As New NotesSession
Dim DB As NotesDatabase
Dim Collection As NotesDocumentCollection
Dim Doc As NotesDocument
Dim AnItem As NotesItem
Dim AnotherItem As NotesItem
Dim i As Integer
Dim Chamber As String

Set DB = Session.CurrentDatabase
Set Collection = DB.UnprocessedDocuments
For i = 1 To Collection.Count
Set Doc = Collection.GetNthDocument( i )
If Doc.Form(0) <> "Document" Then

Else
Print Str(i) + " Processing " & Str(i) & " " & Doc.Title(0)

If Right(Left(Doc.BillTypingID_LMS(0),2) ,1) > 4 Then
Chamber = "Senate"
Else
Chamber = "House"
End If

Set AnItem = Doc.ReplaceItemValue("Chamber_LMS",Chamber)
Select Case Doc.Type_LMS(0)
Case "Bill"
Set AnItem = Doc.ReplaceItemValue("BillTypingName_LMS", "DR" & Left(Chamber,1) & Doc.BillTypingID_LMS(0))
Case "Joint Resolution"
Set AnItem = Doc.ReplaceItemValue("BillTypingName_LMS", "DRJR" & Left(Chamber,1) & Doc.BillTypingID_LMS(0))
Case "Simple Resolution"
Set AnItem = Doc.ReplaceItemValue("BillTypingName_LMS", "DRR" & Left(Chamber,1) & Doc.BillTypingID_LMS(0))
End Select
Call Doc.Save(True,False)
End If
Next
End Sub

previous page