I am using a lotus script agent to create a new document from a open document all works great but when I try to bring values from a field that has multiple values the script only picks up the first value. Will lotus script bring over multiple values, or is there another way to do this? As I mentioned all other field values are saved in the new document as expected.
The code is very straight forward
i.e. newdoc.multivalue = olddoc.multivalue(0)
The field I am trying to populate is a checkbox, multi value allowed. When you view in agent with the scripted debugger you see only the first value, and it is passed to the new document.
Subject: ALL fields in LotusScript are multivalue…
Andre had the right advice for you. Just as an FYI ALL fields from a document access in LotusScript are treated as an array. Thus your attempt to access olddoc.multivalue(0). the (0) means the zero (or first) instance of a zero based multivalue array. Since you are creating a new document on the back end a simple assignment such as Andre suggested will work. If you ever need to process against all elements in a multivalue field you should use some kind of loop.
eg
For i = 0 to Ubound(olddoc.multivalue)
seeThis = olddoc.multivalue(i)
Next
Will loop through all elements in teh multivalue field and set them to the seeThis variable one at a time.
Mark,The advice from Andre Guirard won’t work. It will give you an error.
If you think about it you need to do the following:
newdoc.itemvalue(0) = olddoc.olditemvalue(0)
newdoc.itemvalue(1) = olddoc.olditemvalue(1)
newdoc.itemvalue(2) = olddoc.olditemvalue(2)
newdoc.itemvalue(3) = olddoc.olditemvalue(3)
and so on until there no more values in olditemvalue.
I have done this before, but to give you a hint, get the olditemvalue’s and put them into an Array, them move the array one element at a time to the itemvalue’s.