COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Report Studio => Topic started by: mhauser on 18 Feb 2009 10:20:15 AM

Title: Displaying Row Count of the Entire Report
Post by: mhauser on 18 Feb 2009 10:20:15 AM
I have a list report on the web where I would like to display the row count of the entire report in the header. I would like the report header to say something like this:

This report has 1200 rows

How can I get that "1200" to appear in the header?
Title: Re: Displaying Row Count of the Entire Report
Post by: wyconian on 18 Feb 2009 10:43:34 AM
Hi

This isn't that easy because if you run the report in html (on the web) cognos only renders one page at a time.

I think what you need to do is have a second query that counts the number of items in your main query e.g. if the main query shows sales for accounts the second query should be just a count of the number of accounts based on the same selection criteria as the main report.

You can then add the second report into the header.

Good luck
Title: Re: Displaying Row Count of the Entire Report
Post by: mhauser on 18 Feb 2009 11:56:44 AM
Thank you for the quick response.

I tried adding another query using the same filter parameters as the main query used for the report's results. The new query contains only one data item... count([MYDATA].[SERIALNUMBER])

When I run the report, I get the following error: CRX-API-0005 An error on or around the position '0'. The variable named '[MYDATA].[SERIALNUMBER]' is invalid. I have tried to delete the new query just to get back to the original report, and this error remains.

I am not sure what I am doing wrong.
Title: Re: Displaying Row Count of the Entire Report
Post by: mhauser on 19 Feb 2009 02:25:56 PM
Okay, I found the problem. Your advice worked great but I was not aware of what was needed to make the RowCount display properly.

First, I created a new Query that does a row count as you suggested. Then, I added that row count as a data item to the original query. Then, I needed to go to the Properties window for these two queries and edit the "Cross Product Allowed" value so that it is set to "Allow". Otherwise, you will get a big long error.

Then, add another text item to the header. In the Properties window, change the "Source Type" to "Data Item Value". Select the new data item name from the list.

After all that, you can get a Row Count to appear.

Title: Re: Displaying Row Count of the Entire Report
Post by: Rajaggopal on 02 Mar 2009 12:22:03 AM
Why did u have to go for another separate query to do this? You could have had a data item with 1 in expression and performed a total([DATA ITEM]) and added that data item to the report header. But before doing that u need to associate the query to the page and then display that data item.