Happy Friday All,
I have an action button on a form that will create different form and fill in some fields done in LS. This is working now, however I have to append some data from six different fields in the doc to one field in CurDoc.
I have searched this forum, designer Help, and other stored code I have found…
The code works as it is written, except from the If statement when I am trying to append five fields into the one rtitem2 it doesn’t. The only thing that ends up in that field is the CopyItem To Doc that is called just above the code.
Here is the code in the. Sorry it is so long!
Sub Click(Source As Button)
Dim workspace As New notesuiworkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim CC_db As NotesDatabase
Dim doc As notesdocument
Dim CurDoc As NotesDocument
Dim w As NotesUIWorkspace
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.document
Set CurDoc = New NotesDocument (db)
CurDoc.Form = "MAIN"
'CuDoc is new form and doc is old form
CurDoc.Prefix = doc.Prefix(0)
CurDoc.ECRNum = doc.ECRNum(0)
CurDoc.ProjectNum = doc.ProjectNum(0)
CurDoc.TariffCode = doc.TariffCode(0)
CurDoc.AcctCode = doc.AcctCode(0)
CurDoc.tech_2_1 = doc.TechRel(0)
CurDoc.tech_2 = doc.TechRel(0)
CurDoc.tech_3 = doc.TechRel(0)
CurDoc.tech = doc.TechRel(0)
doc.TRHide = "Yes"
CurDoc.prod_4_1 = doc.ProdRel(0)
CurDoc.prod_4 = doc.ProdRel(0)
CurDoc.prod_5 = doc.ProdRel(0)
CurDoc.prod = doc.ProdRel(0)
doc.PRHide = "Yes"
CurDoc.Lead = doc.SendTo_1
CurDoc.Lead_1 = doc.Lead_1
CurDoc.Lead_2 = doc.Lead_2
CurDoc.Lead_16 = doc.Lead_16
CurDoc.Lead_4 = doc.Lead_4
CurDoc.Lead_5 = doc.Lead_5
CurDoc.Lead_6 = doc.Lead_6
CurDoc.Lead_7 = doc.Lead_7
CurDoc.Lead_8 = doc.Lead_8
CurDoc.Lead_9 = doc.Lead_9
CurDoc.Lead_10 = doc.Lead_10
CurDoc.Lead_11 = doc.Lead_11
CurDoc.Lead_15 = doc.Lead_15
CurDoc.Lead_15_1 = doc.Lead_15_1
CurDoc.Lead_19 = doc.Lead_19
CurDoc.Lead_13 = doc.Lead_13
CurDoc.Lead_14 = doc.Lead_14
CurDoc.Lead_17 = doc.Lead_17
CurDoc.Lead_18 = doc.Lead_18
CurDoc.Lead_20 = doc.Lead_20
CurDoc.Lead_3 = doc.Lead_3
CurDoc.Lead_12 = doc.Lead_12
CurDoc.Lead_21 = doc.Lead_21
CurDoc.Lead_22 = doc.Lead_22
CurDoc.DocHistory = doc.DocHistory
CurDoc.duo = doc.duo
CurDoc.PDP = doc.PDP
CurDoc.CSPQ = doc.CSPQ
CurDoc.ExReport = doc.ExReport(0)
CurDoc.Next_Milestone = doc.Next_Milestone(0)
CurDoc.Report = doc.Report(0)
CurDoc.StatusHistory = doc.StatusHistory(0)
Dim rtitem As NotesRichTextItem
Dim rtitem1 As NotesRichTextItem
Set rtitem = doc.GetFirstItem( "Summary_1" )
Set rtitem1 = doc.GetFirstItem( "StatusHistory_1" )
Call rtitem.CopyItemToDocument( CurDoc, "Summary_1" )
Call rtitem1.CopyItemToDocument( CurDoc, "StatusHistory_1" )
"NOTE This is the section that I am having issues with.
Dim rtitem2 As NotesRichTextItem
Dim rtitem3 As Variant
Dim rtitem4 As NotesRichTextItem
Dim rtitem5 As NotesRichTextItem
Dim rtitem6 As NotesRichTextItem
Dim rtitem7 As NotesRichTextItem
Set rtitem2 = doc.GetFirstItem( "BusinessCase" )
Set rtitem3 = doc.GetFirstItem( "Overview" )
Set rtitem4 = doc.GetFirstItem( "techdesc" )
Set rtitem5 = doc.GetFirstItem( "applicationdesc" )
Set rtitem6 = doc.GetFirstItem( "analysis" )
Set rtitem7 = doc.GetFirstItem( "success" )
"NOTE This copyItem works, the information does not append. I am testing now which is why the 4-7 rtitems are rem’ed out.
Call rtitem2.copyItemToDocument(CurDoc,"BusinessCase")
Call rtitem2.AddNewline(1)
Call rtitem3.AppendRTItem( CurDoc,"BusinessCase" )
'Call rtitem2.AddNewline(1)
'Call rtitem4.AppendRTItem(CurDoc, "BusinessCase" )
'Call rtitem2.AddNewline(1)
'Call rtitem5.AppendRTItem(CurDoc, "BusinessCase" )
'Call rtitem2.AddNewline(1)
'Call rtitem6.AppendRTItem(CurDoc, "BusinessCase" )
'Call rtitem2.AddNewline(1)
'Call rtitem7.AppendRTItem(CurDoc, "BusinessCase" )
'NOTE This is another way that I tried to copy the first one then append the rest of the items in. The copy worked the appends did not…
'Call rtitem2.CopyItemToDocument( CurDoc,"BusinessCase")
'Call rtitem2.AppendText(doc.Overview(0))
'Set rtitem2 = Curdoc.GetFirstItem ("BusinessCase")
'If ( rtitem2.Type = RICHTEXT ) Then
' Call rtitem2.AddNewline(1)
' Call rtitem2.AppendText(doc.Overview(0))
' Call rtitem2.AddNewline(1)
' Call rtitem2.AppendRTItem(doc.techdesc(0))
' Call rtitem2.AddNewline(1)
' Call rtitem2.AppendRTItem(doc.applicationdesc(0))
' Call rtitem2.AddNewline(1)
' Call rtitem2.AppendRTItem(doc.analysis(0))
' Call rtitem2.AddNewline(1)
' Call rtitem2.AppendRTItem(doc.success(0))
'
'End If
'Put in if statement so that I can change to what is needed otherwise I will run a second agent to change all of this
'CurDoc.category_2 = doc.category_2(0)
'CurDoc.category_2_1 = doc.category_2(0)
Call CurDoc.Save(True,False)
'Call w.prompt(PROMPT_OK,"Msg","Your Project Lookup Form has been created")
'Call doc.Save(True,True)
End Sub
'NOTE End of code ************************
Thanks for any help on this.
I know that having the same data stored on two different forms in the same database is a waste of space. However, we are switching to a streamlined form and the “Boss” wants me to have the data available in both form styles for a period of time before they are willing to kill the old form. Plus not all of the old form docs will be moved into the new form.
TIA
Teri