Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Row number for groups and detail
actuser9
Hi, <br />
<br />
I remember seeing this some where in the forums but could not find the post. I am looking to get a row number for the group and detail as shown below using a single variable.<br />
<br />
Any ideas?<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
| RowNumber | Job Role | Employee |
| 1 | role1 | |
| 2 | | Mickey Mouse |
| 3 | | Goofy |
| 4 | | Pluto |
| 5 | role2 | |
| 6 | | Donald Duck |
| 7 | role3 | |
| 8 | | Minnie Mouse |
| 9 | | Doctor Einmug |
</pre>
<br />
Thanks<br />
UY
Find more posts tagged with
Comments
kclark
I've attached an example of how I did this. I created two PGV's in the initialize() of the report called rowNum and grpNum. Then used the following script in the onCreate() of a label in the detail row.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var rowNum = parseInt(reportContext.getPersistentGlobalVariable("rowNum"));
rowNum++;
this.text = rowNum;
reportContext.setPersistentGlobalVariable("rowNum", rowNum.toString());</pre>
<br />
I also placed a label in the group header and used a script similar to the one above in the onCreate()<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var grpNum = parseInt(reportContext.getPersistentGlobalVariable("grpNum"));
grpNum++;
this.text = grpNum;
reportContext.setPersistentGlobalVariable("grpNum", grpNum.toString());</pre>
actuser9
Thank you kclark.
The code seems to be incrementing the rownumber and the group number seperately. I am looking for a single column variable as per the sample RowNumber column in the initial post.
Regards,
UY
Hans_vd
Hi actuser9,
How about this: you copy/paste kclarck's first script in the onCreate of both detail row and header row labels.
actuser9
Hi Hans_vd,
Thank you. That is exactly what I was looking for. The row number seems to be incremental as needed but is it not possible to get this data into a variable as I need to filter the table based on this Row Number?
Regards,
UY