JR Smith
JR Smith

Reputation: 1216

Number of Documents in a LotusNotes view

I am working to integrate a Lotus Notes database into Salesforce using Java. However, I am running into trouble for one portion of the project.

The data I am returning to Salesforce gets initialized in the form of:

String[][] result = new String[id.length][field.length]

id and field are both arrays that I create inside Salesforce and pass as parameters to the Java that handles the web service.

Most views I've had to access have had a unique id to query off of, so it was fairly simple to populate an array of ids that I want to query Lotus Notes with.

However, I ran into a problem with one View that does not have anything available as a unique id. Our solution was to concatenate two columns together as the SF id and just pull the whole View back. This means I just need to tell the results array to be View.NumberOfRecords instead of id.length in size. But for the life of me, I cannot find how programatically pull the number of documents in a view.

Any help on this would be greatly appreciated. I am new to Lotus Notes, and hope to not have to use it again if figuring out simple tasks like this require so much effort.

Upvotes: 0

Views: 410

Answers (2)

Frantisek Kossuth
Frantisek Kossuth

Reputation: 3524

Mindoo blog, source of cutting-edge XPages tips writes about neat trick. Instead of calling getCount/getEntryCount, use documented method of ViewNavigator.skip(amount). With big enough parameter it will skip to last entry, returning number of skipped entries = number of all entries. Should be much faster.

Upvotes: 0

Panu Haaramo
Panu Haaramo

Reputation: 2932

Use getEntryCount() or getTopLevelEntryCount() methods of View class.

Upvotes: 3

Related Questions