Beware of what getColumnValue is returning

When working with view columns that might contain multiple values, remember that the return value of the getColumnValue(“column”) method from the NotesXspViewEntry object is different depending on the number of values in the column of a specific view entry:

  • If the view entry contains a single value, a string is returned.
  • If the view entry contains multiple values, it returns a Vector.
If you always want to have a Vector as the return type, you’ll have to convert it:
var values = rowData.getColumnValue("MultiValueColumn");
if ( (typeof values).toLowerCase() == "string" ) {
 var vTmp = new java.util.Vector();
 vTmp.add(values);
 values = vTmp;
}
Converting the return type is also a possible workaround when working with nested repeat controls: if you set the Iteration to yourRowData.getColumnValue(“MultiValueColumn”) the repeat control won’t work with rows containing a single value.
Be Sociable, Share!