If there is only one entry inside the view you will get an string back.
Is will give you problem if you are using this as the source for an repeat control or somethign elese that is expecting an array.
This is how you fix the problem
function isArray(obj) {
return obj.constructor == Array;
}
var d;
d=@DbColumn("","MyData",1);
if(isArray(d)==false){
d=[d]
}
return d
Happy Coding
Another way... from the Xpages Cheatsheet @ xpagescheetsheet.com is:
SvaraRaderavar r = @DbLookup(...);
return ((r.constructor == Array) ? r : [r]);
I think Jeremy Jodge originally came up with this.
Did't remember that this was already found.
SvaraRaderaSo I reinvented. So said I didn't think of the great Cheetsheet instead.
There are several of the @Functions that work inconsistently. To make it easier to work with, I wrote a wrapper function a while back.
SvaraRaderaIf you wrap all the "problem" function calls with something like this, you don't have to test every call.
http://dontpanic82.blogspot.com/2010/09/xpages-helper-function-for-inconsistent.html