Welcome and thank you for joining our new OpenText forum. Your questions, responses, best practices, and tips shared with other members will help make this channel vibrant. We're glad you're joining us and look forward to collaborating with you online.

Check out the Getting Started With OpenText Forums for tips on personalizing your experience.

Issue with dynamically adding table element in a table in dataset's onFetch() event

i want to read a dataSetRow under onFetch() event and conditionally create an element row/cell/dataitem in a given table dynamically.
Below sample code under onFetch(), creates the data element , however it doesn't display on the report when i run it in pdf or viewer.

var logger = java.util.logging.Logger.getLogger("birt.report.logger");
logger.warning("**inside onfetch()** ");
var result = null;
if (dataSetRow["STATUS"] != null ){
    var tempArr = dataSetRow["STATUS"].split("~");
    result = tempArr[2];

logger.warning("result-> "+result);

if(result !=null){

    elementFactory = reportContext.getDesignHandle().getElementFactory();
    logger.warning("elementFactory-> "+elementFactory);
    var mytable = reportContext.getDesignHandle().getElementByID(9268);
    var firstDetailRow = mytable.getDetail().get(0);
    var firstDetailCell = firstDetailRow.getCells().get(0);
    var mydata = elementFactory.newDataItem( null );
    firstDetailCell.getContent().add( mydata );
    logger.warning("firstDetailRow.getCells().get(0).getContent().get(0)-> "+firstDetailRow.getCells().get(0).getContent().get(0));

Below Log prints the dataitemhandle which was just created. However, it doesn't display on the report.

!ENTRY com.actuate.birt.report.viewer 2 0 2019-01-08 20:18:12.450
!MESSAGE inside onfetch()

!ENTRY com.actuate.birt.report.viewer 2 0 2019-01-08 20:18:12.451
!MESSAGE result-> Status

!ENTRY com.actuate.birt.report.viewer 2 0 2019-01-08 20:18:12.456
!MESSAGE elementFactory-> [email protected]

!ENTRY com.actuate.birt.report.viewer 2 0 2019-01-08 20:18:12.457
!MESSAGE firstDetailRow.getCells().get(0).getContent().get(0)-> org.eclipse.[email protected]

I am using:
OpenText Analytics Designer
Version: 24.4.0
Build id: v20180424

Sign In or Register to comment.