"Field is too large (32K)"

I created a Lotusscript to import large amounts of text from a CSV file into a RT field. When opening some documents, I get the error above. I think that the field “casenotes” is too in some of the exported records, which causes the hiccup. Can someone please point me to an example script that takes a very large text block and splits it into multiple fields? Or is there a better way to handle this one? Here is the script:

Sub Initialize

Dim ticket As String, company As String, group As String, occurred As String, LastModified As String, Individual As String, TicketStatus As String

Dim Details As Variant, Notes As Variant, Resolution As Variant

Dim bigblob As Variant

Dim length As Long

Dim start As Long

Dim nextpos As String

Dim position As Long	

Dim WhereWeAre As Long

Dim EndPos As Variant

Dim fields(10) As Variant

Dim fieldlength As Long



Dim session As New NotesSession

Dim db As notesdatabase

Dim doc As NotesDocument



Set db = session.currentdatabase

	

nextpos = ""","""

EndPos = Chr(10) & Chr(13)	



filenum%=Freefile()

writefile%=filenum%+1



Open "c:\my documents\export queries\ closed tickets.csv" For Input As filenum%

REM Open “c:\test.csv” For Append As writefile%

Do While Not Eof(filenum%)

	

	Line Input #filenum%, bigblob

	length = Len (bigblob)

	start = 1

	position=0

	fieldlength=0	

	

	For i= 1 To 9

		start=start +fieldlength+1

		position = Instr(start, bigblob,nextpos)

		fieldlength=position-start	

		fields(i) = Mid$(bigblob, start, fieldlength)		

		start=start+2

	Next

	

	start=start +fieldlength+1

	length=length-start

	fields(i) = Mid$(bigblob,start,length)

	

	Set doc = db.CreateDocument

	doc.Form = "Remedy Case"

	doc.ticket=fields(1)

	doc.company=fields(2)

	doc.group=fields(3)

	doc.individual=fields(4)

	doc.occurred=fields(5)

	doc.last_modified=fields(6)

	doc.details=fields(7)

	doc.casenotes=fields(8)

	doc.resolution=fields(9)

	doc.TicketStatus=fields(10)

	

	Call doc.Save( False, False )

REM Write #writefile%, bigblob

Loop

Close filenum%

Close writefile%

End Sub

Subject: “Field is too large (32K)”

Change the line:

doc.casenotes=fields(8)

to this:

Set rtitem = New NotesRichTextItem ( doc, “CaseNotes” )

rtitem.AppendText fields(8)

That way your LotusScript agent will create the CaseNotes fields as RichText, and you can put huge (=1GB) amount of text in it. You will still need to slice the text into paragraphs of 64KB with rtitem.AddNewLine 1.

Subject: “Field is too large (32K)”

You may also keep in mind that each notesItem is a container for an array for that item. Each item in the array can be 32k. So for example you havedoc.myfield = blob

change to

blobarray(1) = left$(blob,32760)

blobarray(2) = mid$(blob,32761)

doc.myfield = blobarray

This next variation may also work:

doc.AppendItemValue(“myfield”,left$(blob,32760))

doc.AppendItemValue(…)