Note that there are some explanatory texts on larger screens.

plurals
  1. POProgramatically adding a sort condition to a table in BIRT using JS
    text
    copied!<p>I am attempting to write some script that simplifies table sorting and have been getting quite close but am now wondering if I have found a bug...or have just misunderstood limitations.</p> <p>So my relevant code:</p> <pre><code>var reportRunnable = reportContext.getReportRunnable(); var reportDesign = reportRunnable.getDesignInstance(); var table = reportDesign.getTable(tableName); var sortCondition = org.eclipse.birt.report.engine.api.script.element.StructureScriptAPIFactory.createSortCondition(); sortCondition.setKey("row[\"" + columnKey + "\"]"); sortCondition.setDirection("desc"); table.removeSortConditions(); table.addSortCondition(sortCondition); </code></pre> <p>I am getting a NullPointerException on line 164 in the class Listing: org.eclipse.birt.report.engine.script.internal.element.Listing, in the method removeSortConditions...</p> <pre><code>((org.eclipse.birt.report.model.api.simpleapi.IListing) designElementImpl).removeSortConditions(); </code></pre> <p>So the above implies 'designElementImpl' is null, having looked further at the source it seemed to imply that to instantiate the 'table' object, the following constructor was used:</p> <pre><code>public Table( TableHandle table ); </code></pre> <p>And moving up the heirarchy of super classes, it implies that in the constructor of DesignElement, the following is returning null:</p> <pre><code>designElementImpl = SimpleElementFactory.getInstance( ).getElement(handle); </code></pre> <p>Any one any thoughts? Am I just not able to what I am trying to do?</p> <p>Thanks in advance.</p> <p>EDIT: Should probably add; I'm using BIRT 2.5.1.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload