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)
Add Columns to DataSet
smgomes
Hi,
i'm using BIRT 2.6 and i need to add new Columns to an existing Dataset programmatically...
I'm using the following code:
ScriptDataSetHandle dataSetHandleClone = (ScriptDataSetHandle)design.findDataSet("d2-entidadesdocumentoslinhas");
PropertyHandle columnHint = dataSetHandleClone.getPropertyHandle(IDataSetModel.COLUMN_HINTS_PROP);
PropertyHandle resultSet = dataSetHandleClone.getPropertyHandle(IDataSetModel.RESULT_SET_PROP);
ColumnHint ch = StructureFactory.createColumnHint();
ch.setProperty("columnName", "d2-95");
ch.setProperty("displayName", "NovoCampo95");
columnHint.addItem(ch);
ResultSetColumn rs = StructureFactory.createResultSetColumn();
rs.setColumnName("d2-95");
rs.setPosition(new Integer(95));
rs.setDataType("String");
resultSet.addItem(rs);
design.save();
When i open the report and edit the Dataset the new Column doesn't appear in Tree, if i double click on Dataset properties the new Column appears if i add a new other Column manually! What is wrong?
I can't find a method like refresh() in API...
Thanks for help.
Find more posts tagged with
Comments
smgomes
<strong class='bbc'>Solved</strong><br />
<br />
<br />
Adding this lines to code:<br />
<br />
CachedMetaData cachedMetaData = StructureFactory.createCachedMetaData();<br />
dataSetHandle.setCachedMetaData(cachedMetaData);<br />
<br />
Thanks.