I have a database with documents that contain a rich text field called “html”. I have noticed that in some cases when displaying the properties for the document, there are more than 1 “html” rich text field. The data for the field is broken up into several fields which have the same name. I want to take the fields, remove some text, place them in a new field and then remove the field called “html”. I use getFirstItem(“html”) to get the field data and then remove the item and save the document, but when I try to getFirstItem(“html”) again, there are no more items and the data is lost. How do I retrieve all occurrences of that html field? Thanks,
Craig
Subject: multiple rich text items in document properties
When you use GetFirstItem, you are getting the entire composite field – you don’t need to access the “chunks” separately.
Subject: RE: multiple rich text items in document properties
Not according to the documentation of GetFirstItem, Stan (unless that part is outdated, I didn’t check it).
In many cases, multiple items are not really needed, but just a result of how the document was created. In these cases NotesRichTextItem.Compact can be used to get rid of unnecessary items.
If the problem still exists, I would not save the document after removing the first item, but just keep on looping until NotesDocument.HasItem(“ItemName”) returns false.
Subject: RE: multiple rich text items in document properties
Oh, and as an aside – since the content of a field called HTML is ALL that will be displayed on the web when a document is opened, using it is generally a bad idea. You are committing the design of the application to data – any changes to the application means changing the data in all of the documents. Leave the design where it belongs – on Design elements (forms, pages, etc.).