TeamSpace
Quality vs. quantity Microphone
Home Who We Are What We Do What We've Done Why Work For Us Blog Contact Us

Using XPages to develop complex reports - Part 3

Roy Rumaner - March 12 2013 11:00:00 AM


Continuing on from Part 1 and Part 2 in this series, I once again will explore the intricacies of advanced reporting with XPages. Furthering my example from previous posts, once again the client asked for something else to be added to the XPage. They now want to be able to see the data that these calculations were created from.  It was decided that the easiest way to do this was to add a view panel (Figure 10) which contained all the fields they required.

Figure 10: Overview panel
Image:Using XPages to develop complex reports - Part 3

The next thing that was needed was a way to determine which data they wanted to look at. The obvious answer was to show it by the row of the report so I created a panel with four buttons, one for each row. (Figure 11)

Figure 11: View selection buttons

Image:Using XPages to develop complex reports - Part 3

The code behind each of these buttons was a single line of code (Code Sample 15) that corresponded to each row in the report.

Code Sample 15: View selection button code

viewScope.put("Program", "Program 2")

A Partial Update forced the refresh of the view (Figure 12), which in turn forced the view to refresh and display the data based on the filter. (Figure 13)

Figure 12: Partial refresh

Image:Using XPages to develop complex reports - Part 3

Figure 13: View data source

Image:Using XPages to develop complex reports - Part 3

The computed value is a set to use the viewScope that was set when the button was clicked. (Figure 14)

Figure 14: Filter by column value

viewScope.Program

I also added a checkbox to toggle the view panel on and off. The number of rows was set to 999 at the client’s request to eliminate the need for a pager.

Figure 15: View panel
Image:Using XPages to develop complex reports - Part 3

Add in some CSS to clean up the tables and the final result after putting all the pieces together is very useful. (Figure 16)

Figure 16: Final result
Image:Using XPages to develop complex reports - Part 3

Surprisingly the time to refresh the data each time the date is changed is less than a second in a database with over 10K documents.

I hope you got some value over these series of posts. The real salient point here is that XPages is a powerful tool for so many aspects of business if employed correctly. Please feel free to comment here about any specific questions or drop us a line via the Contact Us page above.