This is from Designer Help - NotesDocument class:

GetFirstItem method:

If multiple items in a document have the same name, programmatic access is limited to the first item. The remaining items yield invalid data. A work-around is to get the first item, process it, remove it, again get the first item (which was the second item), and so on until you process all the items with the same name. If you do not save the document, the items are not actually removed. However, the recommendation is that you avoid creating multiple items with the same name.


This is a small screen shot from the traditional properties dialog:

Image:The dilemma of Body field: I know it’s wrong, but I’m still using it.

Funny right?

BTW, it's wrong. You may still have an access to those fields by NotesDocument.Items array. I mean, I think there is. I will try it in a minute :)

UPDATE: I tried, they are right. You cannot access multiple fields with Items array :(

Serdar Basegmez   |   June 10 2011 11:03:22 AM   |    Development  Lotus Domino    |  
  |   Next   |   Previous

Comments (3)

Gravatar Image
Serdar Basegmez    http://www.developi.com    06/11/2011 11:52:57 AM

@Peter,

I checked again, I couldn't. I will try it with Lotusscript again but it is not working on SSJS.

For example, doc.getItems() is a vector and 6 of those items are Received fields (checked with getName()). I have printed values of each in a for loop but all values are the same.

items=document1.getDocument().getItems().toArray();

for(i=0; i<items.length; i++) {

if(items.getName()=="Received"){

print("Received "+i+":"+items.getValueString());

}

}

Funny :)

Gravatar Image
Ben Langhinrichs    http://www.geniisoft.com/showcase.nsf/GeniiBlog    06/10/2011 5:31:37 PM

I really wish people didn't have to worry about this stuff. It gives rich text a bad name, and is easy enough to fix. (Yes, I can say that, as Midas has handled the issue easily since 1997)

Gravatar Image
Peter Presnell    http://www.gbs.com    06/10/2011 1:35:44 PM

I would suggest re-running your test. You can definitely access all instances of an Item with the same field name using NotesDocument.Items. But as the documentation hints... use it to read/access their contents, not to update.