BIRT Exchange Forum: Rownum for sorted crosstab - BIRT Exchange Forum

Jump to content


 

BIRT Poll: To best make a table fill a pdf page before breaking (PL=page layout, PBI=page break interval) set:

PL: auto, PBI: 0PL: fixed, PBI: 0PL: auto, PBI: 1000000PL: fixed, PBI: 1000000
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rownum for sorted crosstab Rate Topic: -----

#1 User is offline   bitec2 Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 04-March 12


Posted 10 March 2012 - 11:17 AM

Hi.
I have the crosstab which is sorted by total column like in the screenshot:

Posted Image

I need to add the rownum column to the report. The sorting is done by Birt, not in sql, so seems I cannot add the computed column and change it in the "onFetch" event for dataset. I think some script is necessary when the crosstab is being built but my scripting knowledge is too poor so far :(

My crosstab definition is as following (I tried the computed column here):

Posted Image

Any help appreciated!
0

#2 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 12945
  • Joined: 16-May 08


Posted 12 March 2012 - 11:48 AM

You could simply put something like: i = 0, in your initialize script. Then, instead of trying to use your rownum field as a dimension, just put a 2 column / 1 row grid in where your name field is. Put the name field in the right cell and a dynamic textbox in the left cell. For the dynamic textbox expression, put i++; i;. Now, for each row, the variable i will increment and then display in the textbox, giving you a row number. Hope this helps. Let me know if you have questions.
Regards,

Michael

Twitter
Facebook
Blog
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
1

#3 User is offline   bitec2 Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 04-March 12


Posted 12 March 2012 - 12:32 PM

View Postmwilliams, on 12 March 2012 - 11:48 AM, said:

You could simply put something like: i = 0, in your initialize script. Then, instead of trying to use your rownum field as a dimension, just put a 2 column / 1 row grid in where your name field is. Put the name field in the right cell and a dynamic textbox in the left cell. For the dynamic textbox expression, put i++; i;. Now, for each row, the variable i will increment and then display in the textbox, giving you a row number. Hope this helps. Let me know if you have questions.


Marvellous! It works! Great, thanks Mike for you dedication :)

Small question: how can I restrict the widhth of the first cell in the grid so it was constant? I tried to put the width equal 20 px, but this didn't help. Either could not find the "width" property in style.

Posted Image

I put thick borders just to show the variable width of cells
0

#4 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 12945
  • Joined: 16-May 08


Posted 12 March 2012 - 12:58 PM

If you select the grid, then select the tab above the "rownumber" column, you should be able to set the width in the property editor and it should work. If it doesn't, let me know your BIRT version.
Regards,

Michael

Twitter
Facebook
Blog
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users