all groups > sql server reporting services > january 2005 >
You're in the

sql server reporting services

group:

Field outside an aggregate function


Field outside an aggregate function Randy Howie
1/9/2005 8:35:03 PM
sql server reporting services: When previewing a report with a single matrix data region, I am getting the
following warning message (3 times):

The value expression for the textbox ‘textbox2’ references a field outside
an aggregate function. Value expressions in matrix cells should be
aggregates, to allow for subtotaling.

Textbox 2 is the data value in the matrix (intersection value). The value
for textbox2 is:

=Sum(Fields!projectCost.Value)

Since the value is clearly an aggregate, I am assuming that the warning
message is referring to the parameters values I am using to navigate to a
"jump to report". These values are standard field values that (I don't
think) should be aggregates (e.g., =Fields!divisionName.Value,
=Fields!teamName.Value, etc.). Since I am getting the warning 3 times and I
am passing 3 parameters, I assume that it must be warning me about the
parameter values rather than the textbox value.

Two questions:

1) These are just warnings, and the report works fine. Is there a way to
get a "clean" build, or do I just live with the warnings?

2) When I try to do an enhancement to pass a null value when the user links
from the total column rather than body of the matrix, I get an error in
addition to the 3 warnings. When I change the parameter value to:

=iif(inScope(matrix1_divisionName),Fields!divisionName.Value, null)

I get the following error:

The value expression for the textbox ‘textbox2’ contains an error: [BC30451]
Name 'matrix1_divisionName' is not declared.

matrix1_divisionName is a valid group name within the grid.

Any help would be appreciated.

--
RE: Field outside an aggregate function Randy Howie
1/10/2005 6:27:02 PM
Question #1 is still open.

Part of #2 was answered by a syntax error that I missed. The argument for
the inScope function needed to be a string, so enclosing the object name in
quotes solved that. I still need to learn how to pass a NULL in the
expression (the second condition in the IIF). Using the syntax in my
original post, I am told to use System.DBNull, but that does not work. Does
anyone know how to pass a NULL in an expression? I have seen the question
raised here several times, but never an answer.

Thanks.

Randy Howie

-----------------

[quoted text, click to view]
Re: Field outside an aggregate function Robert Bruckner [MSFT]
1/15/2005 4:41:43 PM
#1: You should use the First() aggregate function for the hyperlink actions
in order to get rid of the warning. E.g. =First(Fields!divisionName.Value)

#2: Use the VB keyword 'Nothing' which represents null. You can check values
for being null via e.g. =iif(Fields!x.Value is Nothing, ..., ...)

--
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

AddThis Social Bookmark Button