Skip to main content



      Home
Home » Archived » BIRT » how to set sortstrength in sortcondition programmatically?
how to set sortstrength in sortcondition programmatically? [message #1064531] Wed, 19 June 2013 13:44 Go to next message
Eclipse UserFriend
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 09:29 Go to previous messageGo to next message
Eclipse UserFriend

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 05:50 Go to previous messageGo to next message
Eclipse UserFriend

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 01:41 Go to previous message
Eclipse UserFriend
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
Previous Topic:bar chart, series spacing
Next Topic:Expand Collapse Script
Goto Forum:
  


Current Time: Wed Mar 26 05:20:26 EDT 2025

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

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

Back to the top