Wednesday, February 27, 2013

How do we find the size of a rich text field in Lotus Notes?

I am facing an issue, Its peculiar but still IBM is not fixed this issue,

My database is very old. It is created on 1998. Now my database's version is 6.5.1. So my case everything has its own limit. After a long time, I seen like my db usage is 98% after the completion of compacting. So whenever my document exceeds 32K it can be old or new, the document became spam. Like we can not access the document. We can not open the document. We can not see the property of the document. I had some agents that will take all the documents one by one. Because of this issue, the agent stopped and thrown the error like "field is too large 32k or view's column & selection formulas are too large". I could not find the reason why it is happening.

eg:- If my already existing document has more than 32k of size. I have gone and edited the document. And saved it. The document size exceeds 32k, and it became spam what I mentioned above. If my new document exceeds 32k, I attained the same issue.

I was confused. I tried the following steps.

1. I changed the Text to Summary for all items. Nothing happened.
2. As of Notes constraints, document can have any number of size less than 64GB(about db size). But less than 6 It has some limitation. I guess. Sorry if it is wrong. Number of field should not exceed 3000. So I checked the document size. And tried to reduce that. I deleted contents of the fields and made the document to less than 64K. Same problem came.
3. I created a lot of field. The form had thousands of field. So I removed many field. I counted as a child and made it to 1000 exactly including reserve fields. Like $Revisions.  -  32K error. :(
4. I know that the limitation of RTF(Rich Text Field)  is 1gb. So I ignored.
5. I found the $UpdatedBy field is exceeding 32K of size. So I limited the number of entries for this.





Finally, I found that the issue from Rich text field. I deleted the attachments and reduced the document size less than 32k. and saved it. I got satisfied.

So I planned to restrict the document size to the user. I want to avoid the 32K error in future documents. Better I can stop the attachment size should not exceeds 15k. So I want to fetch the size of the RTF. I found the better solution for that. t refers NotesRichTextItem.

        Set t = doc.GetFirstItem("body")
Dim newdoc As NotesDocument
Set newdoc = db.CreateDocument()
Call t.Copyitemtodocument(newdoc, "reasonType")
Msgbox newdoc.Size

Also I can count the current document size. One funny thing is, our Notes rich text field contents like copy and pate images not an attachments can not be taken without saving the document.


Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim t As Variant
Call uidoc.FieldSetText("SaveOptions","0")
Call uidoc.Save()
uidoc.Refresh
Set db = session.CurrentDatabase
Set doc = uidoc.Document
        msgbox doc.size

But my question to IBM, Why the hell this much big issue can not be solved?

Once the 32K error document has been created then we have to delete the replica copy and take a new replica copy from the source server. This is the only solution for deleting the 32K error documents. You can not delete these document manually.

4 comments:

  1. Did you run a compact -c after you reduced the number of fields? You are talking about fields "on the form", did you mean in the database? Over 1000 fields on one single form sounds like a really bad idea...

    Images which are pasted into a document are of course not saved as attachemnts, but stored internally as either a meta format or in their original format (JPG/GIF, but only if imported and if Notes version is 6.x or higher, IIRC).

    If you want to export images pasted/imported into a document, I suspect you want/need to use Midas LSX.

    Did you try to upgrade to a modern/supported Notes client, like 8.5 and then update the ODS of your database to 51? Do you know that it is not solved in 8.5?
    You asking why IBM can't fix something, but you are using a version of Notes from 2003...

    ReplyDelete
  2. Keep on posting something interesting like this...

    ReplyDelete
  3. As I know, the 32k problem is for one text field. But you get the same error message is the sum of the text fields size is over 64k. I had this problem in a "parameter" document, where every modification was logged, and the log became to large. So I separated the log field into more fields with 10-15k limit. An other important thing is, that if you don't really need a field on the form you can delete it. Of course you can use it as an Item in Lotus Script. So in my case, I removed the log field(s) from the form (I'm using them only from LS) and added a button for popup the value.

    ReplyDelete