June 10 2011 Friday
The dilemma of Body field: I know it’s wrong, but I’m still using it.
This is from Designer Help - NotesDocument class:
This is a small screen shot from the traditional properties dialog:
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 :(
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:
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 :(
Comments (3)
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)
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.
@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 :)