Hello everyone,
I have a unique issues that I've been trying to resolve with SSRS 2008 using custom code. Here is my situation: I have a dataset that pulls in test counts and names. so an example would be:
subject | test name | count
CEP 8 | 2R | 10
CEP 8 | 2R | 12
CEP 8 | 2R | 25
In my report, I have a totals section that tallies the count grouped by subject so it would show as:
CEP 8 | 2R | 37
Here's the tricky part and the reason I need to use custom code. Instead of calculating all three counts, I want it to only calculate the closest 2 counts so it would look like this:
CEP 8 | 2R | 22
I'm baby-stepping the process by slowly modifying the custom code bit by bit so that I can perform calculations to determine which 2 counts are the closest, however, I'm stuck on baby-step #1 in that I can't get data to persist. Meaning I can't even get the correct sums to calculate when I pass the count through the parameter into the custom code. Here's what I have so far:
public dim values as system.collections.arraylist = new system.collections.arraylist() public dim variantSum as double public Function AddValue(ByVal newValue As Decimal) As Decimal values.add(newValue) for i as integer = 0 to values.count - 1 variantSum += values(i) next return variantSum End Function
and my expression for the field I want to show is:
=code.AddValue(Fields!NORMAL_COUNT_1.Value)
Needless to say the calculated numbers are way off. I feel if someone can point me in the right direction that I could figure this out. My main obstacle right now is calculating the right sums even disregarding the closests 2 of 3 counts. If I can get the sums to display properly, I can work the finding of the 2 closest values.
Help!
thank you