How do I Iterate through a dataset in reporting services
I have the following code:
public sub PrettyRows()
dim ds as dataset = report.dataset1
dim GroupName as string = ""
FOR EACH dRow AS Datarow IN
if groupname <> drow(0) then
groupname = drow(0)
drow(0) = groupname
else
drow(0) = ""
NEXT
End Sub
Prot开发者_如何转开发ected Overrides Sub OnInit()
PrettyRows()
end sub
The Protected Overrides Sub OnInit()
is comparable to the load event in VB.NET.
I am utilizing this event to call my custom sub PrettyRows
. This sub will iterate the rows in my dataset and change the first column in each row so that an entry only appears once, This is being utilized to identify what group the row belongs to. The rows are sorted by group and I only wish to display the group name once and I am removing all other references to the group name.
Ideally, I would like to mimic Excel's Merge and Center functionality for each group.
Why not lift this out into a grouping in your Table/Matrix/Tablix etc?
If you want it collapsed/combined over several rows rather than over a header, then you should be able to refer to a hidden text box in a very thin header.
Or use the scoped RowNumber function to detect the first row in the grouping (which is your scope) and hide all the others with a simple iif
It's been some time, sorry, for me to describe exact details.
精彩评论