I have a view retrieving data like
Course Attendee if-student shadow-tutor course-max
CS1 steve no mark 5
CS1 anna yes dan 5
and after retrieving, I select the course, count(attendee), shadow-tutor, course-max where if-student = Parameters!if_student. The result would be like:
Course shadow-tutor Actual# max#
CS1 mark 1
dan 1
CS1 total: 2 5
in the report, I used Sum(Fields!Actual.Value)
and Fields!Max.Value
for the total column. And at the header, I wanted use Sum(Fields!Actual.Value)
and Sum(Fields!Max.Value)
as the total. However it does not work. the Sum(max) will return me the sum of all cols, in this case, it returns 10 instead of 5.
I tried to use a custom code as following:
Public Dim total_cmax As Integer = 0
Public Function sum_cmax(cmax As Integer) As Integer
total_cmax = total_cmax + cmax
Return cmax
End Function
Public Function get_cmax(obj As Object) As Integer
obj.Value = total_cmax
End Function
But interestingly, when I use the get_cmax
in table, it always return me 0. I have to create a textbox with get_cmax
below the table which would generate the correct answer for me.
Any solution for this? I tried lots of method but no one works. I just want the sum can be displayed at the beginning but not the end.