title: Birt - how to manipulate row cells onrowcreate
body: <p>I'm new in Birt scripting and need help with some script.
  I want to merge cells in a table row on row create if they contain equal data.
  For example this table</p>
  
  <pre><code> ------- ------- -------
  |  id1  |   2   |   4   |
   ------- ------- -------
  |  id2  |   5   |   5   |
   ------- ------- -------
  </code></pre>
  
  <p>should look like </p>
  
  <pre><code> ------- ------- -------
  |  id1  |   2   |   4   |
   ------- ------- -------
  |  id2  |       5       |
   ------- ------- -------
  </code></pre>
  
  <p>I've found some examples and now I can for example change row background based on row data onrowcreate:</p>
  
  <pre><code>if (this.getRowData().getExpressionValue(1) == "id1")
  this.getStyle().backgroundColor = "red";
  
  if (this.getRowData().getExpressionValue(1) == "id2")
  this.getStyle().backgroundColor = "blue"; 
  </code></pre>
  
  <p>And another example shows how to merge cells in table header beforeFactory:</p>
  
  <pre><code>importPackage( Packages.org.eclipse.birt.report.model.api );
  elementFactory = reportContext.getDesignHandle().getElementFactory();
  var mytable = reportContext.getDesignHandle().findElement("mytable");
  var myheader = mytable.getHeader( ).get( 0 );
  tcell = myheader.getCells( ).get( 1 ).drop();
  tcell = myheader.getCells( ).get( 0 );
  tcell.setColumnSpan(2);
  tcell.setRowSpan(1);
  </code></pre>
  
  <p>Both examples work fine, but i need to check if there same data in cells before merging them, can I do something similar to beforeFactory script onrowcreate, or may be there is different ways.</p>
  
  <p>Thank you!  </p>