Thursday, March 29, 2012

Can't Sum Table Fields in SQL 2000 Reporting Services Report

I have a report in SQL 2000 Reporting Services with several tables.
The only thing showing in these tables are the group footers because
the detail data is not needed.
I am needing to add a total for a column in each table and then add
those totals together in a text box.
When ever I do this I am getting the following errors:
The value expression for the text box 'textbox58' uses an aggregate
function on a report item. Aggregate functions can be used only on
report items contained in page headers and footers.
The value expression for the text box 'textbox37' uses an aggregate
expression without a scope. A scope is required for all aggregates
used outside of a data region unless the report contains exactly one
data set.
I've tried several different ways and still can't figure it out, PLEASE
HELP!!A few design suggestions. If you don't need the detail then don't return it.
Let SQL Server do the work. But, let's say you continue the way you are
today. What I do sometimes is to add a colum to the result set and make it
calculated, then using the expression editor make it the sum of the two
fields. This makes things a whole lot easier at times.
Once you have done this you can use the expression editor, base it on the
dataset and sum up the column.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<jasper.frazee@.gmail.com> wrote in message
news:1162406083.894334.80910@.k70g2000cwa.googlegroups.com...
>I have a report in SQL 2000 Reporting Services with several tables.
> The only thing showing in these tables are the group footers because
> the detail data is not needed.
> I am needing to add a total for a column in each table and then add
> those totals together in a text box.
> When ever I do this I am getting the following errors:
> The value expression for the text box 'textbox58' uses an aggregate
> function on a report item. Aggregate functions can be used only on
> report items contained in page headers and footers.
> The value expression for the text box 'textbox37' uses an aggregate
> expression without a scope. A scope is required for all aggregates
> used outside of a data region unless the report contains exactly one
> data set.
> I've tried several different ways and still can't figure it out, PLEASE
> HELP!!
>|||Thanks for the Responce Bruce!
In my dataset there are 5 columns that will alwayse have the same
result and one column that has detail data that needs to be summed. If
I sum that one column in SQL I have to have the other columns in an
aggregate function as well. In SQL 2000 the "First" function is not
supported. Any ways around that?
Once I get the totals in each table on my report how can I grab those
totals and sum them in a textbox? It keeps telling me that "Aggregate
functions can be used only on
report items contained in page headers and footers."
Thanks A Lot!
Jasper
Bruce L-C [MVP] wrote:
> A few design suggestions. If you don't need the detail then don't return it.
> Let SQL Server do the work. But, let's say you continue the way you are
> today. What I do sometimes is to add a colum to the result set and make it
> calculated, then using the expression editor make it the sum of the two
> fields. This makes things a whole lot easier at times.
> Once you have done this you can use the expression editor, base it on the
> dataset and sum up the column.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> <jasper.frazee@.gmail.com> wrote in message
> news:1162406083.894334.80910@.k70g2000cwa.googlegroups.com...
> >I have a report in SQL 2000 Reporting Services with several tables.
> > The only thing showing in these tables are the group footers because
> > the detail data is not needed.
> > I am needing to add a total for a column in each table and then add
> > those totals together in a text box.
> > When ever I do this I am getting the following errors:
> >
> > The value expression for the text box 'textbox58' uses an aggregate
> > function on a report item. Aggregate functions can be used only on
> > report items contained in page headers and footers.
> >
> > The value expression for the text box 'textbox37' uses an aggregate
> > expression without a scope. A scope is required for all aggregates
> > used outside of a data region unless the report contains exactly one
> > data set.
> >
> > I've tried several different ways and still can't figure it out, PLEASE
> > HELP!!
> >|||You can sum the numbers by summing =ReportItems("textbox1").Value +
ReportItems("textbox2").Value etc.
You need to know the names of the textboxes, so you might want to name the
textboxes with something more descriptive than textbox1 etc before you start
summing. :)
(Not sure if it's ReportItems or ReportItem, so you might have to try both.)
Kaisa M. Lindahl Lervik
<jasper.frazee@.gmail.com> wrote in message
news:1162417277.149051.147270@.f16g2000cwb.googlegroups.com...
> Thanks for the Responce Bruce!
> In my dataset there are 5 columns that will alwayse have the same
> result and one column that has detail data that needs to be summed. If
> I sum that one column in SQL I have to have the other columns in an
> aggregate function as well. In SQL 2000 the "First" function is not
> supported. Any ways around that?
> Once I get the totals in each table on my report how can I grab those
> totals and sum them in a textbox? It keeps telling me that "Aggregate
> functions can be used only on
> report items contained in page headers and footers."
> Thanks A Lot!
> Jasper
> Bruce L-C [MVP] wrote:
>> A few design suggestions. If you don't need the detail then don't return
>> it.
>> Let SQL Server do the work. But, let's say you continue the way you are
>> today. What I do sometimes is to add a colum to the result set and make
>> it
>> calculated, then using the expression editor make it the sum of the two
>> fields. This makes things a whole lot easier at times.
>> Once you have done this you can use the expression editor, base it on the
>> dataset and sum up the column.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> <jasper.frazee@.gmail.com> wrote in message
>> news:1162406083.894334.80910@.k70g2000cwa.googlegroups.com...
>> >I have a report in SQL 2000 Reporting Services with several tables.
>> > The only thing showing in these tables are the group footers because
>> > the detail data is not needed.
>> > I am needing to add a total for a column in each table and then add
>> > those totals together in a text box.
>> > When ever I do this I am getting the following errors:
>> >
>> > The value expression for the text box 'textbox58' uses an aggregate
>> > function on a report item. Aggregate functions can be used only on
>> > report items contained in page headers and footers.
>> >
>> > The value expression for the text box 'textbox37' uses an aggregate
>> > expression without a scope. A scope is required for all aggregates
>> > used outside of a data region unless the report contains exactly one
>> > data set.
>> >
>> > I've tried several different ways and still can't figure it out, PLEASE
>> > HELP!!
>> >
>sql

No comments:

Post a Comment