XPages Method Question

In a new application I need to display some statistics via an XPage. One stat is an average of the sum a field. What would be the best way to approach this? (agent?) I need to:

  1. Go through all docs of a categorized Notes view and find the sum of “fieldA”

  2. Calculate the average of “fieldA”

  3. Display the calculated average on an XPage via a label/computed field when the XPage is opened.

Would I run an LotusScript agent on ‘postOpenDocument’ or is there a better way to do this with SSJS?

Any help/direction is appreciated.

Subject: This may help you get the average/total of a column in an xPage

http://notesin9.com/index.php/2010/07/11/notes-in-9-019-xpages-getting-column-totals-from-a-view/

You will notice, that though he displays the view on the xPage, it is NOT related to the calculation he is doing on the label to display the average/total. You can use this method without having the view control. Oh, and this starts at about 8 minutes into the video. The beginning is talking about a LUG meeting that was, at the time, upcoming.

This can get you started on doing this in an xPage. You can also do it using an agent, of course, using the ViewNavigator object to get the average or total of a view column that has totals turned on in the property box of the view.

Subject: Thanks!

Thank you for the direction! This is what I had been trying to do, but I didn’t know how to get a hold of that categorized entry.

Subject: Deleted Duplicate document