Thursday, March 29, 2012

Formula Problem

I get the following error in Report Manager when running a report. The
report runs perfect in visual studio when I preview it.
Reporting Services Error
_____
* An error has occurred during report processing. (rsProcessingAborted)
Get Online Help
* The sort expression for the grouping 'table1_Group1' uses a numeric
aggregate function on data that is not numeric. Numeric aggregate
functions (Sum, Avg, StDev, Var, StDevP, and VarP) can only aggregate
numeric data. (rsProcessingError) Get Online Help
_____
Microsoft Reporting Services
I pass two parameters, qty and sortdate. As the formulas show below,
when they select qty and ascending, it uses sum(fields). When I pick
date, it does not use sum.
This will sort by the value in the sortby parameter. Used for sortdate
field in data.
=iif(Parameters!Direction.Value="Descending" AND
Parameters!SortBy.Value<>"quantity",Fields(Parameters!SortBy.Value).Value,0)
When I need to sort by the sum of the qty since it is grouped, I do
this...
=iif(Parameters!Direction.Value="Descending" AND
Parameters!SortBy.Value="quantity",sum(Fields(Parameters!SortBy.Value).Value),0)
As I said above, this works perfect in visual studio when I preview it.
Any Ideas?What is the datatype of Fields!quantity.Value? Most likely it is not a
System.Int32 at runtime.
You may want to try this (assuming you want to sum up integers):
=iif(Parameters!Direction.Value="Descending" AND
Parameters!SortBy.Value="quantity",
sum(CInt(Fields(Parameters!SortBy.Value).Value)), 0)
Or use this if you want to actually sum double:
=iif(Parameters!Direction.Value="Descending" AND
Parameters!SortBy.Value="quantity",
sum(CDbl(Fields(Parameters!SortBy.Value).Value)), 0.0)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"John Geddes" <john_g@.alamode.com> wrote in message
news:eTl79Cj4EHA.3504@.TK2MSFTNGP12.phx.gbl...
> I get the following error in Report Manager when running a report. The
> report runs perfect in visual studio when I preview it.
> Reporting Services Error
> _____
>
> * An error has occurred during report processing. (rsProcessingAborted)
> Get Online Help
> * The sort expression for the grouping 'table1_Group1' uses a numeric
> aggregate function on data that is not numeric. Numeric aggregate
> functions (Sum, Avg, StDev, Var, StDevP, and VarP) can only aggregate
> numeric data. (rsProcessingError) Get Online Help
> _____
> Microsoft Reporting Services
>
> I pass two parameters, qty and sortdate. As the formulas show below,
> when they select qty and ascending, it uses sum(fields). When I pick
> date, it does not use sum.
> This will sort by the value in the sortby parameter. Used for sortdate
> field in data.
> =iif(Parameters!Direction.Value="Descending" AND
>
Parameters!SortBy.Value<>"quantity",Fields(Parameters!SortBy.Value).Value,0)
> When I need to sort by the sum of the qty since it is grouped, I do
> this...
> =iif(Parameters!Direction.Value="Descending" AND
>
Parameters!SortBy.Value="quantity",sum(Fields(Parameters!SortBy.Value).Value
),0)
>
> As I said above, this works perfect in visual studio when I preview it.
> Any Ideas?
>

No comments:

Post a Comment