XPages - totalling a subset of column entries

Okay I think my last question wasn’t direct enough. I’m trying to compute a total by taking a view (which is not on the page) and adding up one column of a subset of the documents in that view (defined in this case by a date range and an ID cross-reference).

If I were to do this in a normal form, I would have a function that takes the ID, start date, and end date. It would go to a view categorized by ID, and I would get a view navigator limited by that category. I would then step through the view entries and when I got to the start date I would add the relevant column for each entry until I got to the end date, and the function would return that value.

How would I go about this in XPages? Is there a good way using server-side javascript? Is there a built in way to just do an AJAX call to a notes agent and write the result to a field?

The other question is how to identify the field. I’m thinking of creating a computed field, which is set to HTML, and consists of something like “<DIV ID=TOTAL_” + rowIndex + “>”. Then my javascript action would iterate through each row of my REPEAT, invoking the ajax url call, and writing the result to the div for that rowIndex.

Does that seem doable, or am I headed off into crazyland here because there is a far easier way?

Subject: Re: XPages - totalling a subset of column entries

You should be able to use a Computed Field control with the value set to Server-side javascript doing exactly what you would do with LotusScript. You should have the same NotesViewNavigator, getAllEntriesByKey etc. functionaity. The only bit that may not be straightforward is the date comparison - that may require a bit of trial and error to get the right formatting/code because of date handling in XPages.

The power of server-side javascript for omething like this is that it builds on your existing knowledge of lotusscript, opens access to the NotesDatabase object (or any other Notes Database on that server), runs under the web user’s authority (so preserving reader/author access), and avoids the need for an agent (so is better for server prcessing).

Regards

Paul