Why can’t Domino do this…?
Scenario: Any Domino application that requires reports.
Typical Solution: Create a different view for each report.
Upside: Extremely easy
Downside: High maintenance, performance hit from excessive indexing, and can easily become a navigational nightmare.
A Better way?: Anything where one can build a view on the fly.
If any of you got through .NET for Domino Developers Part 4 you have seen how easy the .NET Gridview object is to deliver views to the end user. Yet if You have ever looked at the XML source code of a .NET page, you will see that each column is a seperate object with different parameters depending on the column type (columns bound to a field, link columns, template columns). This means that each column object can be programmatically created, and placed on the page at runtime. Couple the ability to dynamically create and place view columns, with the ability to dynamically build your database queries, and you will have a truly powerful view/report structure. So one view-page can service an almost infinte number of reports/views.
For example, with the content management system that I am writing with .NET 2.0, we need the ability to sort content based upon author, category, date, status, and company. We created a single page that gives the user options for filtering, and sorting, and within the VB code we can alter the query and change the order of the columns.
The report page will look something like this:

From within the code, we can parse out the information like sort field and direction:
If Request.QueryString("sort") <> "" Then
strSort = Request.QueryString("sort")
Else
strSort = "date"
End If
If Request.QueryString("dir") <> "" Then
strSortDir = Request.QueryString("dir")
Else
strSortDir = "ASC"
End If
Then we create our individual columns:
Dim bfldCreated As BoundField = New BoundField()
Dim bfldAuthor As BoundField = New BoundField()
bfldCreated.DataField = "modDate"
bfldCreated.HeaderText = "Created"
bfldCreated.ItemStyle.Width = 85
bfldCreated.ItemStyle.VerticalAlign = VerticalAlign.Top
bfldAuthor.DataField = "contentCreatorFull"
bfldAuthor.HeaderText = "Author"
bfldAuthor.ItemStyle.Width = "140"
bfldAuthor.ItemStyle.VerticalAlign = VerticalAlign.Top
Then place our columns depending upon the sort/filter criteria:
ElseIf strSort = "auth" Then
GridView1.Columns.Add(bfldAuthor)
GridView1.Columns.Add(bfldCreated)
Else
GridView1.Columns.Add(bfldCreated)
GridView1.Columns.Add(bfldAuthor)
Then I pass our sort and filter parameters to our stored procedure, bind the data source , and voila!, reports to your hearts content, all from only one page to maintain. Why can’t Domino do this?
April 12th, 2006 at 3:11 pm
I think Domino can almost do that, you just have to build a lot of it yourself. I did this sort of thing in R5 and R6 for two different customers. The biggest piece of work was buliding a “Query Builder” page so they could CRUD queries. Writing something to parse this into a database search formula wasn’t so hard, and streaming the output as a RichText item was pretty painless too. In the R6 scenario, I used some client side JS to add sorting to the columns after the page loaded.
What it wasn’t was elegant. Not a lot of OO on the backend, just a lot of conditional argument parsing to form up a Domino friendly query formula. You pretty much dumped a query out, no fancy XML, but I don’t see a reason the concept couldn,t be upgraded. Like I said, you just have to build more of it yourself with Domino.
April 12th, 2006 at 5:15 pm
Sure, it CAN be done, but it always seems that we went out of our way to make these things happen. We hacked the crap out of the Domino model to get the results to where it had to be. With some AJAX and XSL lovin’ it can happen on any platform. I just want my to eat my cake…
April 13th, 2006 at 11:10 am
This is a very nice way of using search and ordering. I would love to see it in Domino. As discussed on Jake’s site, http://www.codestore.net/store.nsf/unid/BLOG-20060201?OpenDocument Domino’s search really needs at least something like ‘Order by’ parameter. Without it you need to use document collection sorting routines or do it with XML and XSL. (Which one is better and/or faster anyway? Has anyone done any testing? I would go the document collection way…) JS sorting is only good for small amounts of data that doesn’t spread multiple pages. But neither is as elegant as creating views on the fly with .NET. Will it ever be possible in Domino?
May 8th, 2006 at 9:37 am
[…] I recently wrote about dynamic report views with .NET 2.0, which led to the need to read up on dynamic image generation for charting purposes. .NET 2.0 provides the developer with the GDI+ package that allows us to create chart graphics at runtime. For this article I’ll cover a basic bar chart, and a pie chart, but the capabilities of the GDI+ package go far beyond this. […]