Can you use something like a pivot function?
http://weblogs.sqlteam.com/jeffs/articles/5091.aspx
Or write a pivoted Dto and a transform method to convert what you get
from the database to your view.
 
I use a similar approach with data for rendering purposes and it works
quite well.
 
________________________________

From: Bjorn I [mailto:[EMAIL PROTECTED] 
Subject: Pivot table / cross tabs

Have anybody done any work with pivot tables/cross tabs using Ibatis?
 
My query returns a list of employees and hours they can charge to each
contract. The contract IDs are dynamic in name and number, so my cross
tab would be a list of employees, with n columns with the contract id,
and the hours they can charge. 
Name        #123        #456        #789    ... ... ...                
J. Smith        44            55            12
 
The only way I am able to return tthis using Ibatis is to use hashtable
or IList. But the result does not match well when binding to a web
control such as gridview. First of all, I won't know the header/column
name, and second, .NET does not populate the gridview automatically, I
would have to do it behind the scene for each row. 
 
(the reason for doing a cross tab is that the big boss man wants to
recreate an excel spreadsheet he has)


This correspondence is for the named persons only. It may contain confidential 
or privileged information or both. No confidentiality or privilege is waived or 
lost by any mis transmission. If you receive this correspondence in error 
please delete it from your system immediately and notify the sender. You must 
not disclose, copy or relay on any part of this correspondence, if you are not 
the intended recipient. Any opinions expressed in this message are those of the 
individual sender except where the sender expressly, and with the authority, 
states them to be the opinions of the Department of Emergency Services, 
Queensland.

Reply via email to