Author Topic: Howto display only the first row of a list??  (Read 1991 times)

Offline nugget

  • Full Member
  • ***
  • Posts: 47
  • Forum Citizenship: +0/-0
Howto display only the first row of a list??
« on: 17 Feb 2009 07:16:42 am »
Hi gurus,

i try to show only the first row of a list but it dosn't work.
i defined a variable (bool) with this content:

RowNumber()>1

then i marked the hole list an add the variable to the list.

can somebody explain me why it not works?

THX
Cognos 8.2

Offline Rajaggopal

  • Senior Member
  • ****
  • Posts: 65
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #1 on: 17 Feb 2009 09:45:05 pm »
i dont clearly understand what u have done but i tried something similar to what u said and it worked for me. This is what i did...

1. Create boolean variable with RowNumber() > 1
2. Select List Columns Body Style and then add this boolean variable as the Style variable.
3. For "Yes" value of the variable set the "Box Type" for List Columns Body Style to None

Another method i used to get this to work:
1. Create two data items - Data item1, Row Number
2. Data item1: have the expression as 1
3. Row Number: have the expression as running-total(Data item1)
4. The aggregate functions of both these data items should be None
5. Add a filter to the query as Row Number = 1

Offline vij

  • Full Member
  • ***
  • Posts: 43
  • Forum Citizenship: +2/-0
Re: Howto display only the first row of a list??
« Reply #2 on: 26 Feb 2009 06:31:14 am »
If you have cognos 8.3
then in that in Report Studio there is an object called as Singleton .
The singleton object retrieves only the first row value for that query


hope it will help u ....
vij
 :)

Offline nugget

  • Full Member
  • ***
  • Posts: 47
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #3 on: 26 Feb 2009 07:41:36 am »
thanks for your reply,

but iam using cognos 8.2
Cognos 8.2

Offline bwingate

  • Associate
  • **
  • Posts: 2
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #4 on: 26 Feb 2009 08:08:00 am »
In the Query that you have hooked up to the list box you should be able to set the max rows retrieved set it to 1.  This might do what you need.

Offline nugget

  • Full Member
  • ***
  • Posts: 47
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #5 on: 27 Feb 2009 12:49:03 am »
sounds good. ;D

i will test it.

Manchmal sieht man den Wald vor lauter Bäumen nicht
Cognos 8.2

Offline nugget

  • Full Member
  • ***
  • Posts: 47
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #6 on: 27 Feb 2009 02:42:12 am »
okay now i testet it and it works perfect.

thx
Cognos 8.2

Offline pattr

  • Associate
  • **
  • Posts: 4
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #7 on: 17 Jun 2009 06:00:41 am »
In the Query that you have hooked up to the list box you should be able to set the max rows retrieved set it to 1.  This might do what you need.

hi my database is returning more number of rows(say 700 rows) but i want to limit to only 5 rows

Offline nugget

  • Full Member
  • ***
  • Posts: 47
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #8 on: 23 Jun 2009 02:13:09 am »
read the post from bwingate

in your case set it to 5
Cognos 8.2

Offline kristielee

  • Associate
  • **
  • Posts: 4
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #9 on: 05 Aug 2009 03:15:56 pm »
What if you only want to display the LAST row in a list report?  I'm using 8.3 and have the average daily balances for each day of the month, but only need the final average.  I don't want to actually display the average daily balance for each day in the month, just the final day.
Sorry to be confusing...
PS...I tried using a singleton, but as stated above, it gives me the first row...

Offline RomanP

  • Associate
  • **
  • Posts: 3
  • Forum Citizenship: +0/-0
Re: Howto display only the first row of a list??
« Reply #10 on: 06 Aug 2009 03:07:23 pm »
What if you only want to display the LAST row in a list report?  I'm using 8.3 and have the average daily balances for each day of the month, but only need the final average.  I don't want to actually display the average daily balance for each day in the month, just the final day.
Sorry to be confusing...
PS...I tried using a singleton, but as stated above, it gives me the first row...

Sort your query descending, this way your last row will become your first row...