Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » how to set sortstrength in sortcondition programmatically?
how to set sortstrength in sortcondition programmatically? [message #1064531] Wed, 19 June 2013 17:44 Go to next message
nari noori is currently offline nari noori
Messages: 33
Registered: November 2012
Member
Hi,

Im trying to sort my report table programmatically in the "onPrepare" script, but im not able to set the sortstrength to Primary:

The code under works, but i want to also set the sort strength to "Primary". If i set the sortCondition.setStrength("Primary"); or sortCondition.setStrength(0); it fails.

importPackage (Packages.org.eclipse.birt.report.model.api.simpleapi);
var sortCondition = SimpleElementFactory.getInstance().createSortCondition();
sortCondition.setKey("row[\"Lastname\"]");
sortCondition.setDirection("desc"); 
this.addSortCondition(sortCondition); 

Thanks in advance Smile
Re: how to set sortstrength in sortcondition programmatically? [message #1065137 is a reply to message #1064531] Mon, 24 June 2013 13:29 Go to previous messageGo to next message
nari noori is currently offline nari noori
Messages: 33
Registered: November 2012
Member

Hi,

didnt get an reply. But wondering if there is an online api doc, that specifies the report api ? something like javadocs for the class sortCondition ?
Re: how to set sortstrength in sortcondition programmatically? [message #1065305 is a reply to message #1065137] Tue, 25 June 2013 09:50 Go to previous messageGo to next message
nari noori is currently offline nari noori
Messages: 33
Registered: November 2012
Member

Yes, i found a solution, i put this in the tables onprepare:

importPackage (Packages.org.eclipse.birt.report.model.api.elements.structures );
importPackage (Packages.org.eclipse.birt.report.model.api );

var sk = StructureFactory.createSortKey();
sk.setKey("row[\"mycolumn\"]");
sk.setDirection("asc");
sk.setStrength(1);

table = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("mytable");
var ph = table.getPropertyHandle(TableHandle.SORT_PROP);
ph.addItem(sk);



i found the programmers reference here:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.birt.doc.isv%2Fmodel%2Fapi%2Findex.html
Re: how to set sortstrength in sortcondition programmatically? [message #1065668 is a reply to message #1065305] Thu, 27 June 2013 05:41 Go to previous message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Sorry for your not getting a response. I've been out of the forums due to preparing for the 4.3 release and the new BIRT Exchange community site update. Glad you found a solution! Smile

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Previous Topic:bar chart, series spacing
Next Topic:Expand Collapse Script
Goto Forum:
  


Current Time: Sat Oct 25 11:17:44 GMT 2014

Powered by FUDForum. Page generated in 0.01740 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software