AppendItemValue does not seem to be working correctly (this is occuring in 5.08, 5.11, 6.0.1 and 6.5MS1).
When appending two items with the same name only one value is being added to both. For example:
Dim ns As New notessession
Set doc = ns.currentdatabase.createdocument
Call doc.appenditemvalue(“bob”, “1”)
Call doc.appenditemvalue(“bob”, “2”)
call doc.save(true, true)
This will create a document with two items called ‘bob’, both with the value of ‘1’.
Has anyone else had this problem? Is it a known issue? Are there any workarounds?
Subject: AppendItemValue not appending different values
I can’t test this behaviour at my end however you can get rid of this issue by creating 2 items using NotesItem object. Hope this would solve your problem.
Subject: RE: AppendItemValue not appending different values
Thanks for your response but this does not seem to work:
Dim ns As New notessession
Set doc = ns.currentdatabase.createdocument
Set item = New NotesItem( doc, “bob”, “1” )
Set item1 = New NotesItem( doc, “bob”, “2” )
This still produces a document with two items called ‘bob’ with the value ‘1’. In addition both item and item1 have the value of ‘1’. Any other ideas?
Subject: AppendItemValue not appending different values
Dim stringArray ( 1 To 2 ) As StringstringArray( 1 ) = “1”
stringArray( 2 ) = “2”
Call doc.AppendItemValue( “bob”, stringArray )
If you had read the help file (should have been your first stop), you would have found the following:
USAGE
To keep the new item in the document, you must call the Save method after calling AppendItemValue.
IF THE DOCUMENT ALREADY HAS AN ITEM CALLED itemName$, APPENDITEMVALUE DOES NOT REPLACE IT. INSTEAD, IT CREATES ANOTHER ITEM OF THE SAME NAME, AND GIVES IT THE VALUE YOU SPECIFY.
The IsSummary property of the new item defaults to True, which means that the item value can be displayed in a view or folder.
Subject: RE: AppendItemValue not appending different values
Perhaps some context…
I am writing a migration tool for a notes app that must take a set of fields (approx 500) from several document types and spread these fields across a series of different documents.
The exact mappings of fields are being stored in keyword documents - defining the source form/field and the target form/field. This allows both easy validation of the tool (we can send excel sheets of these mappings to the customer to receive sign-off), and saves me a whole load of typing 
The tool cache’s these mappings (since it has to migrate around 2000 databases lookup’s all the time will be too slow) on a series of documents (one for each source form) - creating an item for each source field, and placing the destination form/field and translation formulas in an array stored in that items.
This works fine, except that there are around 100 fields that must be sent to multiple places. To do this I have to create several items with the same name on the caching document - but as stated this does not seem to be working.
Does anyone know of any other tools or methods that can do this?
Subject: RE: AppendItemValue not appending different values
This detail would have been helpful in your original post.
Why are you creating a new item for each value instead of one multi value array item that you could loop through?
Subject: RE: AppendItemValue not appending different values
Each item that I create needs 4 values stored in it - target form, target subform, target field and translation formula.
Since I need to be able to have an unlimited number of potential destinations for each field (OK, I could limited it but hey, its a challenge
I figured I could just have multiple items with the same name - hence I found the bug.
Subject: RE: AppendItemValue not appending different values
I hate that you used such shortcut code, but I used both your code and my version and had no problem…
Sub Click(Source As Button)
Dim ns As New notessession
Dim db As NotesDatabase
Set db =ns.currentDatabase
Dim doc As NotesDocument
Set doc = db.createdocument
Call doc.appenditemvalue("bob", "1")
Call doc.appenditemvalue("bob", "2")
Call doc.appenditemvalue("bob", "3")
Call doc.appenditemvalue("bob", "4")
doc.form="dateTest"
Call doc.save(True, True)
End Sub
Subject: RE: AppendItemValue not appending different values
Ah ha!
The code works fine when placed in an action or hotspot button but fails when inside an agent.
Subject: RE: AppendItemValue not appending different values
Just use a single multi-value field, with delimiter characters between your four values and as many values as you have line items. Or, use 4 multivalue fields, onr for each “column”. Nobody designs Notes applications that deliberately use multiple items with the same name; the tools for dealing with these aren’t there. You will actually be able to store more data this way because you won’t be using up your summary item space with multiple copies of the item overhead.
Subject: RE: AppendItemValue not appending different values
That was just the hint I was trying to give him:-)…