Xpages - using an array as an argument to view.getAllDocumentsByKey

I’ve got the following in a Repeat control:

var pageIdx = sessionScope.get(“pageIndex”);

var indexArray = new Array();

indexArray[0] = “en”;

indexArray[1] = pageIdx;

session.getCurrentDatabase().getView(“(view name)”).getAllDocumentsByKey(indexArray);

But the call to getAllDocumentsByKey throws an error. Any ideas why?

thanks

clem

Subject: Did you try a Vector?

It needs a Vector if you want to pass more than one key:

Parameter

Description

java.util.Vector keys

String, Number, DateTime, or DateRange objects that are compared to sorted columns in the view. The first element in the vector is compared to the first sorted column in the view; the second element is compared to the second sorted column; and so on.

Object key

A String, Number, DateTime, or DateRange object that is compared to the first sorted column in the view.

boolean exact

Specify true if you want to find an exact match. If you specify false or omit this parameter, a partial match succeeds.

Howard

Subject: vectors

I assumed Notes would convert a javascript ‘Array’ call into a Vector for java if necessary. If not, how do you build a vector and pass it into the getAllDocumentsByKey method?

clem

Subject: Just new it…

var keys=new java.util.Vector();keys.add(blah);

Hope this helps…

Subject: Sweet!

Thanks guys – it worked! :slight_smile:

This is my first foray into xPages and I’m getting hooked! Nice stuff.

thanks again

clem