Binding of dynamically added columns

Mad1s0n
edited February 11, 2022 in Analytics #1
Hi all,<br />
I need to create a table with one column optional and not displayed if the property is empty for all the items in the table. The rest of the table is from the palette. I adapted the code from the link below:<br />
<a class='bbc_url' href='http://digiassn.blogspot.com/2007/11/birt-dynamic-adding-tables-and-columns.html'>http://digiassn.blogspot.com/2007/11/birt-dynamic-adding-tables-and-columns.html</a><br />
<br />
I only kept the following snipet and placed it in the "initialize" event handler:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>elementFactory = reportContext.getReportRunnable().designHandle.getElementFactory();
dynamicTable = reportContext.getReportRunnable().designHandle.findElement("table");
dynamicTable.insertColumn(6, 1);
myNewRow = dynamicTable.getDetail().get(0);
addedCell = myNewRow.getCells().get(5);
label = elementFactory.newLabel("comment");
addedCell.getContent().add(label);</pre>
<br />
I managed to add the extra-column, though I can't figure out a way to bind this column to my scripted data set.<br />
<br />
Any help accepted.<br />
Thanks!

Comments

  • Hans_vd
    edited December 31, 1969 #2
    Hi Mad1sOn,

    For a binded column, it might be easier to add it in the report design and dynamically remove it (or make it invisible) instead of the other way around.

    Hope this helps

    Hans
    Warning No formatter is installed for the format ipb