LS -- Not copying all of a RTF from one form to another

Greetings,

This is for Notes Client only…

I have a script that is creating form2 in db2 by copying the values from form1 in db1.

Everything works fine except, that the one RTF field that I am copying over does not copy everything. This RTF contains both text and attachments. The problem is, when I did a test and created a form, this field copied all the text and only 3 of the five attachments. If it makes any difference the field that I tested started with Text then had 2 attachments with line spaces between, followed by more text, attachment, text, attachment, text, attachment. The two attachments that did not get copied over were the FIRST two attachments.

I have the “Formulas inherit value from selected document” selected in form2/

Here is my full code:

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 w = New NotesUIWorkspace

Set db = session.CurrentDatabase

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.document   

Set CC_db = New NotesDatabase("Edison/SEL","ENGR\Hardware\engrdev.nsf") 

Set CurDoc = New notesdocument(CC_db)





CurDoc.Form = "PM" 



CurDoc.FormType = doc.FormType(0)

CurDoc.ECONo = doc.ECONo(0)

CurDoc.SendTo_1 = doc.SendTo_1(0)

CurDoc.ProjectNum = doc.ProjectNum(0)

CurDoc.ExReport = doc.ExReport(0)

CurDoc.Next_Milestone = doc.Next_Milestone(0)

CurDoc.tech_2_1 = doc.tech_2_1(0)

CurDoc.prod_4_1 = doc.prod_4_1(0)



CurDoc.LbHr = doc.LbHr(0)

CurDoc.LbHr_1 = doc.LbHr_1(0)

CurDoc.LbHr_2 = doc.LbHr_2(0)

CurDoc.LbHr_3 = doc.LbHr_3(0)

CurDoc.LbHr_4 = doc.LbHr_4(0)

CurDoc.DrtExp = doc.DrtExp(0)

CurDoc.DrtExp_1 = doc.DrtExp_1(0)

CurDoc.DrtExp_2 = doc.DrtExp_2(0)

CurDoc.DrtExp_3 = doc.DrtExp_3(0)

CurDoc.DrtExp_4 = doc.DrtExp_4(0)

CurDoc.TotProInves = doc.TotProInves(0)

CurDoc.TotProInves_1 = doc.TotProInves_1(0)

CurDoc.TotProInves_2 = doc.TotProInves_2(0)

CurDoc.TotProInves_3 = doc.TotProInves_3(0)

CurDoc.TotProInves_4 = doc.TotProInves_4(0)

CurDoc.ProdCost = doc.ProdCost(0)

CurDoc.ProdCost_1 = doc.ProdCost_1(0)

CurDoc.ProdCost_2 = doc.ProdCost_2(0)

CurDoc.ProdCost_3 = doc.ProdCost_3(0)



CurDoc.status1 = doc.status1(0)

CurDoc.status1_1 = doc.status1_1(0)

CurDoc.status1_2 = doc.status1_2(0)

CurDoc.status1_3 = doc.status1_3(0)

CurDoc.stat_6 = doc.stat_6(0)

CurDoc.stat_7 = doc.stat_7(0)

CurDoc.stat_8 = doc.stat_8(0)

CurDoc.stat_9 = doc.stat_9(0)

'**************This is the section that is only pulling in some of the data.

Dim rtitem As NotesRichTextItem

Set rtitem = doc.GetFirstItem( "BusinessCase" )

Call rtitem.CopyItemToDocument( CurDoc, "Report" )

'********************

Call CurDoc.Save(True,False)

End Sub

Any help or clarifications with this would be most helpful.

Thanks

Teri

Subject: LS – Not copying all of a RTF from one form to another

Hello Teri,

Why don’t you try AppendRTItem method instead of copyitemtodocument e.g.

'**************This is the section that is only pulling in some of the data.

Dim rtitemA As NotesRichTextItem

dim rtitemB as NotesRichTextItem

Set rtitemA = doc.GetFirstItem( “BusinessCase” )

Set rtitemB = New NotesRichTextItem(CurDoc , “Report”)

If ( rtitemA.Type = RICHTEXT And rtitemB.Type = RICHTEXT ) Then

Call rtitemB.AppendRTItem( rtitemA )

End if

Call curDoc.ComputeWithForm(False,False)

Hope This helps…

Best Regards,

Munish Kaushik

Subject: RE: LS – Not copying all of a RTF from one form to another

Munish,

I tried your suggestion, however it is having the same results. The first two attachments are still not being copied over.

Any other suggestions?

UPDATE: I went in and found that if I removed the enters from between the text and the attachments (so that there is text in front of the attachments) it will copy them over. Hmm does this really have to be done this way?

Thanks

Teri