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)
BeforeFactory TABLE creation
delee88
In the report I am building, I need to create a table based on columns selected from a list box on
a parameter form. The columns will be used to create an SQL statement that will populate the table.
I am doing this in the Beforefactory event in the report. The table is built and the correct colums
and data show in the report, but the column widths are not optimal, and I need create border for the
cells.
I can't find any scripting examples that show setting column widths or how to set borders via
javascript in the context below. Does anyone have an example, or point me to where this is documented?
Part of the beforeFactory event code is below
reportDesignHandle = reportContext.getDesignHandle();
elementFactory = reportDesignHandle.getElementFactory()
dsHandle = elementFactory.newOdaDataSet( "Data Set");
dsHandle.setDataSource("ORCL");
generateSQL(); // populates paramCOLS based on those selected from parameter form
qry = "Select CHARGE_NUMBER " + paramCOLS + " from charge_info where rownum < 50";
dsHandle.setQueryText( qry );
reportDesignHandle.getDataSets( ).add( dsHandle );
mytable = elementFactory.newTableItem( null, 3, 1, 1, 1 );
mytable.setWidth( "100%" );
Find more posts tagged with
Comments
mwilliams
Here are a couple options for setting the widths of the columns:
myTable.findColumn(0).setStringProperty("width","3in"); //sets the first column's width
myTable.getColumns().get(3).setStringProperty("width","3in"); //sets the fourth column's width
And here is a way you can set the border. You'd have to step through all the cells of the table:
myTable.getCell(0,-1,1,1).setOnCreate("this.getStyle().borderBottomColor = 'black'; this.getStyle().borderBottomStyle = 'solid';"); //sets the bottom border of the first column's header cell
There may be other ways to do this, as well, but this should get you started, at least!
Hope this helps. Let me know if you have questions.