COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: saumil287 on 05 Dec 2011 10:43:15 PM

Title: Display Starting 10 records in list report
Post by: saumil287 on 05 Dec 2011 10:43:15 PM
Hi all,
I have a list containing date column named PDC.

I want to display the 10 records order by date column in ascending order.

I tried using rank func but it displays the top 10 rows order by revenue col which I dont want.

Is there any way to display only the starting 10 latest records in a list report.
Like we do in a sql writing Top 10.
I also tried the same but giving an error.

thanks
Title: Re: Display Starting 10 records in list report
Post by: Gyana.Sahoo on 06 Dec 2011 05:43:15 AM
Hi,.
  use the Date dataitem in rank function. Rank(PDC)<=10. It will shows the latest top 10 date.
Title: Re: Display Starting 10 records in list report
Post by: saumil287 on 07 Dec 2011 02:41:41 AM
Hi
Thanks for your reply
I want to display the 10 records order by date in ascending order.
Cant we restrict the no of rows like we do in sql server using Top 10
Thanks again.
Title: Re: Display Starting 10 records in list report
Post by: Gyana.Sahoo on 09 Dec 2011 01:53:18 AM
Hi,
Can you please brifely explain how exactly you want the output.

Revenue      Date
-----------      -------
1                 01-01-2010
2                 02-01-2010
.
.
.
x                xx-xx-xxxx

Title: Re: Display Starting 10 records in list report
Post by: shricognos on 09 Dec 2011 03:27:18 AM
data:
sno      Revenue        Date
-----     ------------   ---------------
   1         100            1-1-2011
   2          20             2-1-2011
   X           X              XXXXXXX
   X           X              XXXXXXX
   98      1000         29-1-2011
   99      150           30-1-2011
   100     200          31-1-2011

way1:   "rank([Date])<=10" (or) "rank([Date] DESC)<=10"
             then Last/Latest 10 records come. ( sno=91 to sno=100)
way2:   "rank([Date] ASC)<=10"
             then first 10 records come. ( sno=1 to sno=10)
Title: Re: Display Starting 10 records in list report
Post by: HalfBloodPrince on 09 Dec 2011 03:38:32 AM
Hi, you can use Rank function to restrict the no of rows.
For eg. to retrieve top five unit prices sort unit price column descending and use function as
rank([Unit sale price] at [Product name]) in a query calculation with name Top five
then go to Query tab in summary filters add filter as Top five < 5

This will provide you top five rows.
Hope this will help.
Title: Re: Display Starting 10 records in list report
Post by: saumil287 on 11 Dec 2011 11:18:21 PM
Hi All,
Finally I got it.
Thank you very much.