How to add data cells to group header?
Hi,
I currently have a report where users can choose up to 10 columns to be displayed in a table.
I am using the following code to dynamically insert the columns and data into the detail row of the table.
var mytable = reportContext.getDesignHandle().findElement("MainTable");
for (j=1; j<10;j++) {
if (params["column_"+j]!="blank") {
//second parameter is before(-1) or after(1)
mytable.insertColumn(j,1);
//get first detail row
mydetail = mytable.getDetail().get(0);
//get first column and add detail data item
var tcell = mydetail.getCells( ).get( j );
var mydata = elementFactory.newDataItem( null );
mydata.setResultSetColumn( params["column_"+j].value);
tcell.getContent( ).add( mydata );
//get header and add label
var myheader = mytable.getHeader( ).get( 0 );
tcell = myheader.getCells( ).get( j );
var mylabel = elementFactory.newLabel( null );
mylabel.setText( params["column_"+j].displayText );//$NON-NLS-1$
tcell.getContent( ).add( mylabel );
}
This is working fine but I have now been asked to re-create the report so that the data is not but in the detail but into the 'lowest' of 4 possible groups that might have been setup.
So my question is how would i need to alter this code to insert the data cells into the groupheader row and not into the detail row of the table.
Thanks in advance.
I currently have a report where users can choose up to 10 columns to be displayed in a table.
I am using the following code to dynamically insert the columns and data into the detail row of the table.
var mytable = reportContext.getDesignHandle().findElement("MainTable");
for (j=1; j<10;j++) {
if (params["column_"+j]!="blank") {
//second parameter is before(-1) or after(1)
mytable.insertColumn(j,1);
//get first detail row
mydetail = mytable.getDetail().get(0);
//get first column and add detail data item
var tcell = mydetail.getCells( ).get( j );
var mydata = elementFactory.newDataItem( null );
mydata.setResultSetColumn( params["column_"+j].value);
tcell.getContent( ).add( mydata );
//get header and add label
var myheader = mytable.getHeader( ).get( 0 );
tcell = myheader.getCells( ).get( j );
var mylabel = elementFactory.newLabel( null );
mylabel.setText( params["column_"+j].displayText );//$NON-NLS-1$
tcell.getContent( ).add( mylabel );
}
This is working fine but I have now been asked to re-create the report so that the data is not but in the detail but into the 'lowest' of 4 possible groups that might have been setup.
So my question is how would i need to alter this code to insert the data cells into the groupheader row and not into the detail row of the table.
Thanks in advance.
0
Comments
-
Hi,
managed to find a solution after digging around in this forum. Found a post on deleting cells from group header so re-used that code.
Added the following to my code to determine at which 'level' in the table the data cells should be inserted:
if (params["data_level"] =="Group1")
{mydetail = mytable.getGroups().get(0).getHeader().get(0);}
else if (params["data_level"] =="Group2")
{mydetail = mytable.getGroups().get(1).getHeader().get(0);}
else if (params["data_level"] =="Group3")
{mydetail = mytable.getGroups().get(2).getHeader().get(0);}
else if (params["data_level"] =="Group4")
{mydetail = mytable.getGroups().get(3).getHeader().get(0);}
else {mydetail = mytable.getDetail().get(0);}0
Categories
- All Categories
- 107 Developer Announcements
- 53 Articles
- 106 General Questions
- 142 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 76 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 118 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management