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("");
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 2 0 2019-01-08 20:18:12.450
!MESSAGE inside onfetch()

!ENTRY 2 0 2019-01-08 20:18:12.451
!MESSAGE result-> Status

!ENTRY 2 0 2019-01-08 20:18:12.456
!MESSAGE elementFactory-> [email protected]

!ENTRY 2 0 2019-01-08 20:18:12.457
!MESSAGE firstDetailRow.getCells().get(0).getContent().get(0)-> [email protected]

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


  • Can you please describe or share a picture the desired result? You probably do not need all of that code running for every row that is created.

    Jeff F.
    Customer Support Engineer I
Sign In or Register to comment.