COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Report Studio => Topic started by: TCM on 30 Apr 2007 03:33:40 PM

Title: Returning A Certain Number Of Records To A Report
Post by: TCM on 30 Apr 2007 03:33:40 PM
I would like create a report that only pulls back a certain number of records, for example I would like to pull back 5 accounts that have a reportfield of 61. I used a filter like the one below, which passes validation but doesn't return any data even though it really should. Any suggestions on how to do this?

running-count ([CUSTOMERNUMBER])<6 and [Gas].[CIMASTERREPORTCODE].[REPORTFIELD]=61
Title: Re: Returning A Certain Number Of Records To A Report
Post by: COGNOiSe administrator on 01 May 2007 06:50:35 AM
Use rank([CUSTOMERNUMBER]) instead. Also, those two filters should be separate, 61 on detail and 6 on summary.
Title: Re: Returning A Certain Number Of Records To A Report
Post by: TCM on 14 May 2007 10:09:13 AM
I received the data I was looking for after breaking out the filters and using running-count. Using rank gave me the same results. Is there a way for me to pick up different account numbers each time the report is ran though? If I run this report everyday, I get the same accounts numbers every day. Is there a way to pick random records?
Title: Re: Returning A Certain Number Of Records To A Report
Post by: COGNOiSe administrator on 17 May 2007 02:49:25 AM
The trick would be to create a calculated column using database side random() function and then putting rank() on it. If you don't have a random function in FM and RS, you can always add it (check the documentation for step-by-step instructions).