Avatar of Darude1234
Flag for Netherlands

asked on 

Field is too large (32K) error on specific documents when exporting data

I'm trying to export Lotus Notes Data to csv and especially the universal id's with the username.
I've already managed to export the documents and also managed to export many of the fields through other agents but i'm now trying to export the unique id's of the documents with the shortname if available or else the reader of the document.
It works: The data is exporting, but the problem i'm facing is that after about 4 hours of exporting the agent stops with an error:
"Notes error: Field is too large (32K) or View's column & selection formulas are too large"

And I can't find a way to skip the specific document and suppress this warning.
I've also tried to log the universal id of the document, but the universal id's that were last logged (and are next to it) don't give me an error when I open the documents.
I've already done a compact & fixup on the database, and also tried to copy the database to local and run it again (as some posts say it should help), but all have not lead to a solution.

Can someone tell me how i can find the related document and fix the field (ideally)?
Or else: Is there a way to just skip the document if this error occurres and go on to the next document?
I expected that 'On error resume nextdoc' would suppress the error, but this didn't make any sense and the error is still popping up.

This is the Agent i'm currently using (I'm not an expert in Lotusscript so it may be a bit messy):

Private Const MODULE 	= "Agent: Export-document-unique-ids-with-shortname"

Sub Initialize()
	On Error GoTo ErrorHandler
	Set AppLog 	= New ErrorLog(MODULE)
	Call AppLog.LogAction("Agent has started")
	Dim ses		As New NotesSession
	Dim dbProj As New NotesDatabase("SERVER/ORG","Apps\Application.nsf")	
	Dim colProj	As NotesDocumentCollection
	Dim docProj	As NotesDocument
	Dim strSearch	As String
	Dim fileNum As Integer
	Dim fileName As String
	fileNum% = FreeFile()
	fileName$ = "c:\temp\export_universalids_with_shortname.csv"
	strSearch	= {(Form="fmDocument" | Form="fmEmployee") & (DocDeleted <> "1" & DocDeleted <> "2") & !@IsAvailable($Conflict)}
	Set colProj	= dbProj.Search(strSearch,Nothing, 0)
	Set docProj	= colProj.GetFirstDocument()

	Dim LineToWrite As String
	Dim row As Integer
	row = 0
	Open fileName$ For Output As fileNum%
	LineToWrite = "DocUniversalID;ShortName;UserName"
	Print #fileNum%, LineToWrite
	LineToWrite = ""
	Do While Not docProj Is Nothing
		If(docProj.HasItem("ShortName")) Then
			Call AppLog.LogAction(docProj.UniversalID & CStr(docProj.getItemValue("ShortName")(0)))
			LineToWrite = CStr(docProj.UniversalID) & ";" _
			& CStr(docProj.getItemValue("ShortName")(0)) & ";"
			If(docProj.HasItem("DocReaders")) Then
				LineToWrite = LineToWrite & CStr(docProj.getItemValue("DocReaders")(0)) & ";"
				LineToWrite = LineToWrite & ";"
			End If
		ElseIf(docProj.HasItem("DocReaders")) Then
			Call AppLog.LogAction(docProj.UniversalID & CStr(docProj.getItemValue("DocReaders")(0)))
			LineToWrite = CStr(docProj.UniversalID) & ";" _
			& CStr(docProj.getItemValue("DocReaders")(0)) & ";"
			If (docProj.HasItem("UniversalID")) Then
				Call AppLog.LogAction(docProj.UniversalID & "- No fields available")
				LineToWrite = CStr(docProj.UniversalID) & ";" _
				& ";"
				Call AppLog.LogAction("Nothing available")
				LineToWrite = ""
			End If	
		End If
		If (LineToWrite <> "")Then
			Print #fileNum%, LineToWrite
		End If
		Set docProj	= colProj.GetNextDocument( docProj)
	Close fileNum%
	Call AppLog.LogAction("File saved in: " & fileName)
	Call AppLog.LogAction("Agent has ended")
	'Close fileNum%
	Exit Sub
	Call AppLog.LogError(Err, Error$ & " in " & MODULE & "." & GetThreadInfo(LSI_THREAD_PROC) & " line " & Erl)
	Resume NextDoc	
End Sub

Open in new window

Lotus IBM

Avatar of undefined
Last Comment
Sjef Bosman

8/22/2022 - Mon