sort by code [message #162922] |
Fri, 19 May 2006 09:43  |
Eclipse User |
|
|
|
Originally posted by: barrerager.delsatgroup.com
I'm modifying the webviewer servlet I want the user select the sort colums
for the report at runtime, can someone help me with an example or/and
documentation on how to achieve this.
Thank you in advance.
Barrera, German.
|
|
|
|
|
|
Re: sort by code [message #163812 is a reply to message #163576] |
Tue, 23 May 2006 10:35   |
Eclipse User |
|
|
|
Originally posted by: barrerager.delsatgroup.com
This works fine but I want to do this for every column in every report, thus
i want to do this by code automatically. Also in my previous post I've
confussed the requirement. I'v started asking how to include sorts
dinamically an later I've asked how to hide columns, sorry for this
confussion.
We're planning to do several improvements to the web viewer so we need
documentation and examples on how to modify the report design at runtime.
We're having problems trying to figure out how to access and modify the
diferent parts of the report design, such as filters, orders, colums,
groups, totals, etc.
Thank you.
Barrera, German.
"Jason Weathersby" <jweathersby@actuate.com> escribi
|
|
|
Re: sort by code [message #163902 is a reply to message #163812] |
Tue, 23 May 2006 17:30  |
Eclipse User |
|
|
|
Here is an example of how to modify the first visibility rule on a column.
This will change the example I posted earlier.
Jason
import java.io.IOException;
import java.util.Iterator;
import org.eclipse.birt.report.model.api.ColumnHandle;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.DesignEngine;
import org.eclipse.birt.report.model.api.DesignFileException;
import org.eclipse.birt.report.model.api.HideRuleHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.TableHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException ;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConst ants;
import org.eclipse.birt.report.model.elements.ReportDesign;
import com.ibm.icu.util.ULocale;
public class ModifyReport {
static void modifyReport()throws IOException, SemanticException,
DesignFileException
{
ReportDesignHandle designHandle = null;
SessionHandle sessionHandle = null;
ReportDesign design = null;
DesignConfig dc = new DesignConfig();
dc.setConfigurationVariable("BIRT_HOME",
"C:\\birt-runtime-2.1RC2\\birt-runtime-2_1_0\\ReportEngine");
sessionHandle = new DesignEngine( dc ).newSessionHandle( ULocale.ENGLISH );
designHandle = sessionHandle.openDesign(
"c:\\test\\modifyreport\\customerdetail.rptdesign" );
design = (ReportDesign)designHandle.getModule( );
TableHandle table = (TableHandle) designHandle.findElement( "myTable" );
ColumnHandle column = (ColumnHandle)table.getColumns().get(2);
Iterator visibilities = column.visibilityRulesIterator( );
//only change the first
if ( visibilities.hasNext( ) )
{
HideRuleHandle ruleHandle = (HideRuleHandle) visibilities.next( );
ruleHandle.setFormat( DesignChoiceConstants.FORMAT_TYPE_ALL );
String expression = "true";
ruleHandle.setExpression(expression );
}
designHandle.save();
design.close( );
sessionHandle.closeAll(true);
System.out.println("Finished!");
}
public static void main(String[] args) {
try
{
modifyReport( );
}
catch ( Exception e )
{
e.printStackTrace();
}
}
}
"Barrera, German" <barrerager@delsatgroup.com> wrote in message
news:e4v6fm$tku$1@utils.eclipse.org...
> This works fine but I want to do this for every column in every report,
> thus
> i want to do this by code automatically. Also in my previous post I've
> confussed the requirement. I'v started asking how to include sorts
> dinamically an later I've asked how to hide columns, sorry for this
> confussion.
> We're planning to do several improvements to the web viewer so we need
> documentation and examples on how to modify the report design at runtime.
> We're having problems trying to figure out how to access and modify the
> diferent parts of the report design, such as filters, orders, colums,
> groups, totals, etc.
> Thank you.
>
> Barrera, German.
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
|
|
|
Powered by
FUDForum. Page generated in 0.56176 seconds