If I have an existing multi value field in the back end, how can I use SSJS to add a value to it? I try this:
Array = DataSource.getItemValue( “FieldName” );
Array.push( NewValue );
DataSource.replaceItemValue( “FieldName”, Array );
And it seems to work the first time, but subsequently goes sideways if you try it multiple times. (like [[OriginalValues, NewValue1], NewValue2] etc)
getItemValueArray shows in the Script Editor under XSP as a method of NotesXSPDocument, but it’s not in the help? Using it does not seem to make much difference?
Does anyone have anything like this working?
Subject: Do you have a sample you could send on?
Hi Mike,
Do you have a sample of this which you could send on so that we can get to the bottom of this?
REgards,
Paul.
paul_hannan@ie.ibm.com
Subject: Weird return on getItemValue
I gotta a similar problem.
On the script below it process a getItemValue method:
temp=new Array();
var m=docGrupo.getItemValue(“Members”);
var n=m.elements();
while(n.hasMoreElements())
temp.push(n.nextElement());
docGrupo.replaceItemValue(“Members”, temp.sort());
return true;
But, this script works only when I have just one element in “Members”.
I figure out that getItemValue is returning a Vector of Vectors!
So, I include the following test:
…
while(n.hasMoreElements())
var o=n.nextElement();
if(typeof(o)==“java.util.Vector”){
var p=o.elements();
while(p.hasMoreElements())
temp.push(p.nextElement());
}else{
temp.push(o);
}
…
Why this is happening?
Is it someking of a bug?