Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

How to access the current value within a list control? Expand / Collapse
Posted Monday, September 17, 2012 10:47 PM


Group: General Forum Members
Last Login: Monday, February 18, 2013 6:04 PM
Points: 109, Visits: 56
I have a list control which groups on currency. Within the list control I display the detailed rows of all records filtered to those with a value >= £500.

However for each row I need to calculate the percentage of the total of the dataset.

Because I am filtering it I can't use Sum(Fields!Amount.Value) so I am trying this:

=100.00*Fields!Amount.Value/Sum((IIf(Fields!Currency.Value = "£", Fields!Amount.Value, CDec(0))),"DataSet")

So where the hardcoded currency symbol is I need to access the current value of currency for the list control, but because my sum of is scoped at dataset level any field access is dataset level. Ideally I'd like something like the following, otherwise any other ideas on how to solve this problem.

=100.00*Fields!Amount.Value/Sum((IIf(Fields!Currency.Value = myListControl.Value, Fields!Amount.Value, CDec(0))),"DataSet")

In fact, thinking about it, it would work if I could access the row level data at that point, but how to do that when its at dataset scope within the sum statement?

Hope that makes sense, any help appreciated.
Post #1360553
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse