Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

R5 LotusScript: Assigning values to a multivalue field doesn't work

737 views
Skip to first unread message

Fischer

unread,
Jul 8, 2001, 1:12:31 PM7/8/01
to
Hi All !

I am trying to change a multivalue field. I achieve this, when multivalue
field or value being assigned is empty, or I assign values of the same
quantity. (ie there are 3 values in the field and I assign a 3 values array,
it works).

But when the quantity of values does not match (ie array being assigned has
2, or 4 or ... values), I do see assignment in debugger, but when I return
to document, there's nothing changed.

I use following code in a click event of a button:

Dim anArray As Variant
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document

anArray = doc.MultivalueField
' ... Some processing here with anArray ...
uidoc.EditMode = True
doc.MultivalueField = anArray

also I tried following assignment (instead of last line in previous)

Dim item As NotesItem
Set item = doc.GetFirstItem("MultivalueField")
Item.Values = anArray

Result is always exactly the same.

What do I do wrong???

Best regards, Alex.

P.S. When I write

doc.MultivalueField = EMPTY
doc.MultivalueField = anArray

the 1st assignment works, but 2nd does not - I become empty field, when
quantities do not match.


StringFellow

unread,
Jul 9, 2001, 6:06:02 AM7/9/01
to
hi there,

check the designer help on ReDim. this will probably help you out.

cheers rob

Alex Gossen

unread,
Jul 9, 2001, 8:32:02 AM7/9/01
to
hi,

> check the designer help on ReDim. this will probably help you out.

could you please explain what do you mean? do i have to redimension the
field value?

i don't manage that, with redim at least


StringFellow

unread,
Jul 9, 2001, 9:50:29 AM7/9/01
to
Hi there,

Another example can be found within the TableWalker template. Likely
to be found within the Notes.net Sandbox downloads.

Cheers Rob

JLucien

unread,
Jul 9, 2001, 10:07:35 AM7/9/01
to

If you don't know how many elements are going to be in the array, you
are going to have to use a dynamic array. That's where the ReDim
keyword comes in. Used in conjunction with the Preserve keyword you
can resize arrays on the fly. To write an array to a field use a
Forall loop with the AppendToTextList method of notesItem

aList = doc.List
count = Ubound (aList)
Redim Preserve aList (count + 1)
aList (count + 1) = doc.NewItem(0)
doc.List = aList

****
forall elements in aList
Call item.AppendToTextList( elements )
end forall
call doc.Save


or be slick and use the Evaluate method:

doc.List = Evaluate ( {List : NewItem}, doc)

The Designer Help should have enought o get you going.

HTH,
JLucien

Alex Gossen

unread,
Jul 9, 2001, 3:32:35 PM7/9/01
to
Hi all,

due to "StringFellow" I have found correct answer:

i must use ReplaceItemValue, then it works.

Thanx to all.


Peter Nacken

unread,
Jul 11, 2001, 7:12:39 AM7/11/01
to Alex Gossen
Dim v as Variant

v = Doc.GetItemValue("Field")

and than you have v(0) v(1) ...

Peter

Peter Nacken

unread,
Jul 11, 2001, 7:20:03 AM7/11/01
to Fischer
Fischer wrote:
>
> Hi All !
>
> I am trying to change a multivalue field. I achieve this, when multivalue
> field or value being assigned is empty, or I assign values of the same
> quantity. (ie there are 3 values in the field and I assign a 3 values array,
> it works).
>
> But when the quantity of values does not match (ie array being assigned has
> 2, or 4 or ... values), I do see assignment in debugger, but when I return
> to document, there's nothing changed.
>
> I use following code in a click event of a button:
>
> Dim anArray As Variant
> Dim ws As New NotesUIWorkspace
> Dim uidoc As NotesUIDocument
> Dim doc As NotesDocument
> Set uidoc = ws.CurrentDocument
> Set doc = uidoc.Document
>
> anArray = doc.MultivalueField
> ' ... Some processing here with anArray ...
> uidoc.EditMode = True
> doc.MultivalueField = anArray
>
> also I tried following assignment (instead of last line in previous)
>
> Dim item As NotesItem
> Set item = doc.GetFirstItem("MultivalueField")
> Item.Values = anArray
>
Try this

forall m in anArray
call Item.AppendToTextList(m)
end forall
call uidoc.reload

0 new messages