Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » User Defined Sort On Grouped Data(Sort report data in ascending or descending order as specified by the user.)
User Defined Sort On Grouped Data [message #646376] Thu, 23 December 2010 10:09 Go to next message
TicTac  is currently offline TicTac
Messages: 3
Registered: December 2010
Junior Member
Hi,

I am trying to allow report users to sort data on any column and in any sort direction (asc/desc). So far, after poring over many websites, I am still unable to achieve this.

Here is the problem:

In this contrived example the report has 3 tables; Customer Details, Order Details 1 and Order Details 2. The aim is to order by column 1 descending, in all 3 tables. In the Customer Details table this is done by including the following code for the "onPrepare" event:

importPackage( Packages.org.eclipse.birt.report.engine.api.script.element );
importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );

var sortCondition = StructureScriptAPIFactory.createSortCondition();
sortCondition.setKey("row[\"CUSTOMERNUMBER\"]");
sortCondition.setDirection("desc");

var sortKey = sortCondition.getStructure();
this.addSortCondition( SimpleElementFactory.getInstance().createSortCondition(sortK ey));

In the Order Details 1 table I have used the same method as above but this time it has no effect. This table is grouped by ORDERNUMBER, so presumably I would need to get to the "group" itself, before applying the sort condition.

With this in mind I have an Order Details 2 table. In the "beforeFactory" event I have included the following code, attempting to change the sort condition:

importPackage(Packages.org.eclipse.birt.report.model.api.ele ments);
delm = reportContext.getDesignHandle().findElement("OrderTest");

tghOrderTest = delm.getGroups().get(0);
tghOrderTest.setKey("row[\"ORDERNUMBER\"]");
tghOrderTest.setSortDirection("desc"); //"asc"

This code has no effect, although...curiously, if I swap the last two lines of code, the report does render "ORDERNUMBER" in descending order. It appears that there is a problem with the "setKey" code although I can't think why, as the syntax is identical to the working version in the "Customer Details" table.

I am new to BIRT and may have overlooked something really obvious, but having spent some time trying various options I am none the wiser.

Can you help?

Report code:

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
<property name="units">in</property>
<method name="beforeFactory">< ![CDATA[importPackage(Packages.org.eclipse.birt.report.model .api.elements);
delm = reportContext.getDesignHandle().findElement("OrderTest");

tghOrderTest = delm.getGroups().get(0);
tghOrderTest.setKey("row[\"ORDERNUMBER\"]");
tghOrderTest.setSortDirection("desc"); //"asc"



]]></method>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source" id="1030">
<property name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet " name="CustomerDataSet" id="1031">
<list-property name="columnHints">
<structure>
<property name="columnName">CUSTOMERNUMBER</property>
<text-property name="displayName">CUSTOMERNUMBER</text-property>
<text-property name="heading">CUSTOMERNUMBER</text-property>
</structure>
<structure>
<property name="columnName">CUSTOMERNAME</property>
<text-property name="displayName">CUSTOMERNAME</text-property>
<text-property name="heading">CUSTOMERNAME</text-property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CUSTOMERNAME</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNUMBER</property>
<property name="nativeName">CUSTOMERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CUSTOMERNAME</property>
<property name="nativeName">CUSTOMERNAME</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select customernumber, customername
from customers
order by customernumber asc]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet " name="OrderDataSet" id="1048">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<text-property name="displayName">ORDERNUMBER</text-property>
<text-property name="heading">ORDERNUMBER</text-property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<text-property name="displayName">QUANTITYORDERED</text-property>
<text-property name="heading">QUANTITYORDERED</text-property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select ordernumber, quantityordered
from CLASSICMODELS.ORDERDETAILS
order by ordernumber asc]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design" xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CUSTOMERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CUSTOMERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNAME</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CUSTOMERNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CUSTOMERNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTLASTNAME</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTACTLASTNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTACTLASTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTFIRSTNAME</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTACTFIRSTNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTACTFIRSTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PHONE</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PHONE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PHONE</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ADDRESSLINE1</design:name>
<design:position>6</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ADDRESSLINE1</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ADDRESSLINE1</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ADDRESSLINE2</design:name>
<design:position>7</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ADDRESSLINE2</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ADDRESSLINE2</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CITY</design:name>
<design:position>8</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CITY</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CITY</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>STATE</design:name>
<design:position>9</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>STATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>STATE</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>POSTALCODE</design:name>
<design:position>10</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>POSTALCODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>POSTALCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>COUNTRY</design:name>
<design:position>11</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>COUNTRY</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>COUNTRY</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>SALESREPEMPLOYEENUMBER</design:name>
<design:position>12</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>SALESREPEMPLOYEENUMBER</design:displayName >
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>SALESREPEMPLOYEENUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CREDITLIMIT</design:name>
<design:position>13</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CREDITLIMIT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CREDITLIMIT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table name="Customer1" id="1032">
<property name="dataSet">CustomerDataSet</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">CUSTOMERNUMBER</property>
<text-property name="displayName">CUSTOMERNUMBER</text-property>
<expression name="expression" type="javascript">dataSetRow["CUSTOMERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">CUSTOMERNAME</property>
<text-property name="displayName">CUSTOMERNAME</text-property>
<expression name="expression" type="javascript">dataSetRow["CUSTOMERNAME"]</expression >
<property name="dataType">string</property>
</structure>
</list-property>
<method name="onPrepare"><![CDATA[importPackage( Packages.org.eclipse.birt.report.engine.api.script.element );
importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );

var sortCondition = StructureScriptAPIFactory.createSortCondition();
sortCondition.setKey("row[\"CUSTOMERNUMBER\"]");
sortCondition.setDirection("desc");

var sortKey = sortCondition.getStructure();
this.addSortCondition( SimpleElementFactory.getInstance().createSortCondition(sortK ey)); ]]></method>
<column id="1046"/>
<column id="1047"/>
<header>
<row id="1049">
<cell id="1050">
<label id="1052">
<property name="fontWeight">bold</property>
<property name="textAlign">left</property>
<text-property name="text">Customer Details Table</text-property>
</label>
</cell>
<cell id="1051"/>
</row>
<row id="1033">
<cell id="1034">
<label id="1035">
<property name="textAlign">left</property>
<text-property name="text">CUSTOMERNUMBER</text-property>
</label>
</cell>
<cell id="1036">
<label id="1037">
<property name="textAlign">left</property>
<text-property name="text">CUSTOMERNAME</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="1038">
<cell id="1039">
<data id="1040">
<property name="whiteSpace">nowrap</property>
<method name="onPrepare"><![CDATA[importPackage( Packages.org.eclipse.birt.report.engine.api.script.element );
importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );

var sortCondition = StructureScriptAPIFactory.createSortCondition();
sortCondition.setKey("row[\"CUSTOMERNUMBER\"]");
sortCondition.setDirection("desc");

var sortKey = sortCondition.getStructure();
this.addSortCondition( SimpleElementFactory.getInstance().createSortCondition(sortK ey)); ]]></method>
<property name="resultSetColumn">CUSTOMERNUMBER</property>
</data>
</cell>
<cell id="1041">
<data id="1042">
<property name="whiteSpace">nowrap</property>
<property name="resultSetColumn">CUSTOMERNAME</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="1043">
<cell id="1044"/>
<cell id="1045"/>
</row>
</footer>
</table>
<table name="Order1" id="1053">
<property name="dataSet">OrderDataSet</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<text-property name="displayName">ORDERNUMBER</text-property>
<expression name="expression" type="javascript">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<text-property name="displayName">QUANTITYORDERED</text-property>
<expression name="expression" type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">SUM_QUANTITY</property>
<text-property name="displayName">SUM_QUANTITY</text-property>
<property name="dataType">float</property>
<simple-property-list name="aggregateOn">
<value>OrderNumber</value>
</simple-property-list>
<property name="aggregateFunction">SUM</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
<expression name="value" type="javascript">row["QUANTITYORDERED"]</expression>
</structure>
</list-property>
</structure>
</list-property>
<method name="onPrepare"><![CDATA[importPackage( Packages.org.eclipse.birt.report.engine.api.script.element );
importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );

var sortCondition = StructureScriptAPIFactory.createSortCondition();
sortCondition.setKey("row[\"ORDERNUMBER\"]");
sortCondition.setDirection("desc");

var sortKey = sortCondition.getStructure();
this.addSortCondition( SimpleElementFactory.getInstance().createSortCondition(sortK ey)); ]]></method>
<column id="1067"/>
<column id="1068"/>
<header>
<row id="1069">
<cell id="1070">
<label id="1072">
<property name="fontWeight">bold</property>
<property name="textAlign">left</property>
<text-property name="text">Order Details Table (Example 1)</text-property>
</label>
</cell>
<cell id="1071"/>
</row>
<row id="1054">
<cell id="1055">
<label id="1056">
<property name="textAlign">left</property>
<text-property name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="1057">
<label id="1058">
<property name="textAlign">left</property>
<text-property name="text">QUANTITYORDERED</text-property>
</label>
</cell>
</row>
</header>
<group id="1073">
<property name="groupName">OrderNumber</property>
<property name="interval">none</property>
<property name="sortDirection">asc</property>
<expression name="keyExpr" type="javascript">row["ORDERNUMBER"]</expression>
<structure name="toc">
<expression name="expressionValue" type="javascript">row["ORDERNUMBER"]</expression>
</structure>
<property name="repeatHeader">true</property>
<property name="hideDetail">false</property>
<property name="pageBreakAfter">auto</property>
<property name="pageBreakBefore">auto</property>
<property name="pageBreakInside">auto</property>
<header>
<row id="1074">
<cell id="1075">
<data id="1080">
<property name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="1076">
<data id="1081">
<property name="resultSetColumn">SUM_QUANTITY</property>
</data>
</cell>
</row>
</header>
</group>
<footer>
<row id="1064">
<cell id="1065"/>
<cell id="1066"/>
</row>
</footer>
</table>
<table name="OrderTest" id="1082">
<property name="dataSet">OrderDataSet</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<text-property name="displayName">ORDERNUMBER</text-property>
<expression name="expression" type="javascript">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<text-property name="displayName">QUANTITYORDERED</text-property>
<expression name="expression" type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED2</property>
<text-property name="displayName">SUM_QUANTITY</text-property>
<property name="dataType">float</property>
<simple-property-list name="aggregateOn">
<value>OrderNumber</value>
</simple-property-list>
<property name="aggregateFunction">SUM</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
<expression name="value" type="javascript">row["ORDERNUMBER"]</expression>
</structure>
</list-property>
</structure>
</list-property>
<column id="1096"/>
<column id="1097"/>
<header>
<row id="1098">
<cell id="1099">
<label name="Order2" id="1101">
<property name="fontWeight">bold</property>
<text-property name="text">Order Details Table (Example 2)</text-property>
</label>
</cell>
<cell id="1100"/>
</row>
<row id="1083">
<cell id="1084">
<label id="1085">
<text-property name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="1086">
<label id="1087">
<text-property name="text">QUANTITYORDERED</text-property>
</label>
</cell>
</row>
</header>
<group id="1102">
<property name="groupName">OrderNumber</property>
<property name="interval">none</property>
<property name="sortDirection">asc</property>
<expression name="keyExpr" type="javascript">row["ORDERNUMBER"]</expression>
<structure name="toc">
<expression name="expressionValue" type="javascript">row["ORDERNUMBER"]</expression>
</structure>
<property name="repeatHeader">true</property>
<property name="hideDetail">false</property>
<property name="pageBreakAfter">auto</property>
<property name="pageBreakBefore">auto</property>
<property name="pageBreakInside">auto</property>
<header>
<row id="1103">
<cell id="1104">
<data id="1109">
<property name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="1105">
<data id="1110">
<property name="resultSetColumn">QUANTITYORDERED2</property>
</data>
</cell>
</row>
</header>
</group>
</table>
</body>
</report>
Re: User Defined Sort On Grouped Data [message #646556 is a reply to message #646376] Mon, 27 December 2010 12:10 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Take a look at
http://www.birt-exchange.org/org/devshare/designing-birt-rep orts/1308-grouping-and-table-sorting-using-de-api/

Jason

On 12/23/2010 10:09 AM, TicTac wrote:
> <?xml version="1.0" encoding="UTF-8"?>
> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22"
> id="1">
> <property name="createdBy">Eclipse BIRT Designer Version 2.6.1.v20100902
> Build <2.6.1.v20100915-1750></property>
> <property name="units">in</property>
> <method name="beforeFactory"><
> ![CDATA[importPackage(Packages.org.eclipse.birt.report.model
> .api.elements);
> delm = reportContext.getDesignHandle().findElement("OrderTest");
>
> tghOrderTest = delm.getGroups().get(0);
> tghOrderTest.setKey("row[\"ORDERNUMBER\"]");
> tghOrderTest.setSortDirection("desc"); //"asc"
>
>
>
> ]]></method>
> <property name="iconFile">/templates/blank_report.gif</property>
> <property name="bidiLayoutOrientation">ltr</property>
> <property name="imageDPI">96</property>
> <data-sources>
> <oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc"
> name="Data Source" id="1030">
> <property
> name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver
> </property>
> <property name="odaURL">jdbc:classicmodels:sampledb</property>
> <property name="odaUser">ClassicModels</property>
> </oda-data-source>
> </data-sources>
> <data-sets>
> <oda-data-set
> extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
> name="CustomerDataSet" id="1031">
> <list-property name="columnHints">
> <structure>
> <property name="columnName">CUSTOMERNUMBER</property>
> <text-property name="displayName">CUSTOMERNUMBER</text-property>
> <text-property name="heading">CUSTOMERNUMBER</text-property>
> </structure>
> <structure>
> <property name="columnName">CUSTOMERNAME</property>
> <text-property name="displayName">CUSTOMERNAME</text-property>
> <text-property name="heading">CUSTOMERNAME</text-property>
> </structure>
> </list-property>
> <structure name="cachedMetaData">
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">CUSTOMERNUMBER</property>
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">CUSTOMERNAME</property>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> </structure>
> <property name="dataSource">Data Source</property>
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">CUSTOMERNUMBER</property>
> <property name="nativeName">CUSTOMERNUMBER</property>
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">CUSTOMERNAME</property>
> <property name="nativeName">CUSTOMERNAME</property>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <xml-property name="queryText"><![CDATA[select customernumber, customername
> from customers
> order by customernumber asc]]></xml-property>
> </oda-data-set>
> <oda-data-set
> extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
> name="OrderDataSet" id="1048">
> <list-property name="columnHints">
> <structure>
> <property name="columnName">ORDERNUMBER</property>
> <text-property name="displayName">ORDERNUMBER</text-property>
> <text-property name="heading">ORDERNUMBER</text-property>
> </structure>
> <structure>
> <property name="columnName">QUANTITYORDERED</property>
> <text-property name="displayName">QUANTITYORDERED</text-property>
> <text-property name="heading">QUANTITYORDERED</text-property>
> </structure>
> </list-property>
> <structure name="cachedMetaData">
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">ORDERNUMBER</property>
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">QUANTITYORDERED</property>
> <property name="dataType">integer</property>
> </structure>
> </list-property>
> </structure>
> <property name="dataSource">Data Source</property>
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">ORDERNUMBER</property>
> <property name="nativeName">ORDERNUMBER</property>
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">QUANTITYORDERED</property>
> <property name="nativeName">QUANTITYORDERED</property>
> <property name="dataType">integer</property>
> </structure>
> </list-property>
> <xml-property name="queryText"><![CDATA[select ordernumber, quantityordered
> from CLASSICMODELS.ORDERDETAILS
> order by ordernumber asc]]></xml-property>
> <xml-property name="designerValues"><![CDATA[<?xml version="1.0"
> encoding="UTF-8"?>
> <model:DesignValues
> xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
> xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
> <Version>1.0</Version>
> <design:ResultSets derivedMetaData="true">
> <design:resultSetDefinitions>
> <design:resultSetColumns>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CUSTOMERNUMBER</design:name>
> <design:position>1</design:position>
> <design:nativeDataTypeCode>4</design:nativeDataTypeCode>
> <design:precision>10</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>CUSTOMERNUMBER</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>CUSTOMERNUMBER</design:label>
> <design:formattingHints>
> <design:displaySize>11</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CUSTOMERNAME</design:name>
> <design:position>2</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>CUSTOMERNAME</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>CUSTOMERNAME</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CONTACTLASTNAME</design:name>
> <design:position>3</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>CONTACTLASTNAME</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>CONTACTLASTNAME</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CONTACTFIRSTNAME</design:name>
> <design:position>4</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>CONTACTFIRSTNAME</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>CONTACTFIRSTNAME</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>PHONE</design:name>
> <design:position>5</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>PHONE</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>PHONE</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>ADDRESSLINE1</design:name>
> <design:position>6</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>ADDRESSLINE1</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>ADDRESSLINE1</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>ADDRESSLINE2</design:name>
> <design:position>7</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>ADDRESSLINE2</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>ADDRESSLINE2</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CITY</design:name>
> <design:position>8</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>CITY</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>CITY</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>STATE</design:name>
> <design:position>9</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>STATE</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>STATE</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>POSTALCODE</design:name>
> <design:position>10</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>15</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>POSTALCODE</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>POSTALCODE</design:label>
> <design:formattingHints>
> <design:displaySize>15</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>COUNTRY</design:name>
> <design:position>11</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>COUNTRY</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>COUNTRY</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>SALESREPEMPLOYEENUMBER</design:name>
> <design:position>12</design:position>
> <design:nativeDataTypeCode>4</design:nativeDataTypeCode>
> <design:precision>10</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>SALESREPEMPLOYEENUMBER</design:displayName >
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>SALESREPEMPLOYEENUMBER</design:label>
> <design:formattingHints>
> <design:displaySize>11</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CREDITLIMIT</design:name>
> <design:position>13</design:position>
> <design:nativeDataTypeCode>8</design:nativeDataTypeCode>
> <design:precision>15</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> <design:uiHints>
> <design:displayName>CREDITLIMIT</design:displayName>
> </design:uiHints>
> </design:attributes>
> <design:usageHints>
> <design:label>CREDITLIMIT</design:label>
> <design:formattingHints>
> <design:displaySize>22</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> </design:resultSetColumns>
> <design:criteria/>
> </design:resultSetDefinitions>
> </design:ResultSets>
> </model:DesignValues>]]></xml-property>
> </oda-data-set>
> </data-sets>
> <styles>
> <style name="report" id="4">
> <property name="fontFamily">sans-serif</property>
> <property name="fontSize">10pt</property>
> </style>
> <style name="crosstab-cell" id="5">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> <style name="crosstab" id="6">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> </styles>
> <page-setup>
> <simple-master-page name="Simple MasterPage" id="2">
> <page-footer>
> <text id="3">
> <property name="contentType">html</property>
> <text-property name="content"><![CDATA[<value-of>new
> Date()</value-of>]]></text-property>
> </text>
> </page-footer>
> </simple-master-page>
> </page-setup>
> <body>
> <table name="Customer1" id="1032">
> <property name="dataSet">CustomerDataSet</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">CUSTOMERNUMBER</property>
> <text-property name="displayName">CUSTOMERNUMBER</text-property>
> <expression name="expression"
> type="javascript">dataSetRow["CUSTOMERNUMBER"]</expression >
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="name">CUSTOMERNAME</property>
> <text-property name="displayName">CUSTOMERNAME</text-property>
> <expression name="expression"
> type="javascript">dataSetRow["CUSTOMERNAME"]</expression >
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <method name="onPrepare"><![CDATA[importPackage(
> Packages.org.eclipse.birt.report.engine.api.script.element );
> importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );
>
> var sortCondition = StructureScriptAPIFactory.createSortCondition();
> sortCondition.setKey("row[\"CUSTOMERNUMBER\"]");
> sortCondition.setDirection("desc");
>
> var sortKey = sortCondition.getStructure();
> this.addSortCondition(
> SimpleElementFactory.getInstance().createSortCondition(sortK ey));
> ]]></method>
> <column id="1046"/>
> <column id="1047"/>
> <header>
> <row id="1049">
> <cell id="1050">
> <label id="1052">
> <property name="fontWeight">bold</property>
> <property name="textAlign">left</property>
> <text-property name="text">Customer Details Table</text-property>
> </label>
> </cell>
> <cell id="1051"/>
> </row>
> <row id="1033">
> <cell id="1034">
> <label id="1035">
> <property name="textAlign">left</property>
> <text-property name="text">CUSTOMERNUMBER</text-property>
> </label>
> </cell>
> <cell id="1036">
> <label id="1037">
> <property name="textAlign">left</property>
> <text-property name="text">CUSTOMERNAME</text-property>
> </label>
> </cell>
> </row>
> </header>
> <detail>
> <row id="1038">
> <cell id="1039">
> <data id="1040">
> <property name="whiteSpace">nowrap</property>
> <method name="onPrepare"><![CDATA[importPackage(
> Packages.org.eclipse.birt.report.engine.api.script.element );
> importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );
>
> var sortCondition = StructureScriptAPIFactory.createSortCondition();
> sortCondition.setKey("row[\"CUSTOMERNUMBER\"]");
> sortCondition.setDirection("desc");
>
> var sortKey = sortCondition.getStructure();
> this.addSortCondition(
> SimpleElementFactory.getInstance().createSortCondition(sortK ey));
> ]]></method>
> <property name="resultSetColumn">CUSTOMERNUMBER</property>
> </data>
> </cell>
> <cell id="1041">
> <data id="1042">
> <property name="whiteSpace">nowrap</property>
> <property name="resultSetColumn">CUSTOMERNAME</property>
> </data>
> </cell>
> </row>
> </detail>
> <footer>
> <row id="1043">
> <cell id="1044"/>
> <cell id="1045"/>
> </row>
> </footer>
> </table>
> <table name="Order1" id="1053">
> <property name="dataSet">OrderDataSet</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ORDERNUMBER</property>
> <text-property name="displayName">ORDERNUMBER</text-property>
> <expression name="expression"
> type="javascript">dataSetRow["ORDERNUMBER"]</expression >
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="name">QUANTITYORDERED</property>
> <text-property name="displayName">QUANTITYORDERED</text-property>
> <expression name="expression"
> type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="name">SUM_QUANTITY</property>
> <text-property name="displayName">SUM_QUANTITY</text-property>
> <property name="dataType">float</property>
> <simple-property-list name="aggregateOn">
> <value>OrderNumber</value>
> </simple-property-list>
> <property name="aggregateFunction">SUM</property>
> <list-property name="arguments">
> <structure>
> <property name="name">Expression</property>
> <expression name="value"
> type="javascript">row["QUANTITYORDERED"]</expression>
> </structure>
> </list-property>
> </structure>
> </list-property>
> <method name="onPrepare"><![CDATA[importPackage(
> Packages.org.eclipse.birt.report.engine.api.script.element );
> importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );
>
> var sortCondition = StructureScriptAPIFactory.createSortCondition();
> sortCondition.setKey("row[\"ORDERNUMBER\"]");
> sortCondition.setDirection("desc");
>
> var sortKey = sortCondition.getStructure();
> this.addSortCondition(
> SimpleElementFactory.getInstance().createSortCondition(sortK ey));
> ]]></method>
> <column id="1067"/>
> <column id="1068"/>
> <header>
> <row id="1069">
> <cell id="1070">
> <label id="1072">
> <property name="fontWeight">bold</property>
> <property name="textAlign">left</property>
> <text-property name="text">Order Details Table (Example 1)</text-property>
> </label>
> </cell>
> <cell id="1071"/>
> </row>
> <row id="1054">
> <cell id="1055">
> <label id="1056">
> <property name="textAlign">left</property>
> <text-property name="text">ORDERNUMBER</text-property>
> </label>
> </cell>
> <cell id="1057">
> <label id="1058">
> <property name="textAlign">left</property>
> <text-property name="text">QUANTITYORDERED</text-property>
> </label>
> </cell>
> </row>
> </header>
> <group id="1073">
> <property name="groupName">OrderNumber</property>
> <property name="interval">none</property>
> <property name="sortDirection">asc</property>
> <expression name="keyExpr"
> type="javascript">row["ORDERNUMBER"]</expression>
> <structure name="toc">
> <expression name="expressionValue"
> type="javascript">row["ORDERNUMBER"]</expression>
> </structure>
> <property name="repeatHeader">true</property>
> <property name="hideDetail">false</property>
> <property name="pageBreakAfter">auto</property>
> <property name="pageBreakBefore">auto</property>
> <property name="pageBreakInside">auto</property>
> <header>
> <row id="1074">
> <cell id="1075">
> <data id="1080">
> <property name="resultSetColumn">ORDERNUMBER</property>
> </data>
> </cell>
> <cell id="1076">
> <data id="1081">
> <property name="resultSetColumn">SUM_QUANTITY</property>
> </data>
> </cell>
> </row>
> </header>
> </group>
> <footer>
> <row id="1064">
> <cell id="1065"/>
> <cell id="1066"/>
> </row>
> </footer>
> </table>
> <table name="OrderTest" id="1082">
> <property name="dataSet">OrderDataSet</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ORDERNUMBER</property>
> <text-property name="displayName">ORDERNUMBER</text-property>
> <expression name="expression"
> type="javascript">dataSetRow["ORDERNUMBER"]</expression >
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="name">QUANTITYORDERED</property>
> <text-property name="displayName">QUANTITYORDERED</text-property>
> <expression name="expression"
> type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="name">QUANTITYORDERED2</property>
> <text-property name="displayName">SUM_QUANTITY</text-property>
> <property name="dataType">float</property>
> <simple-property-list name="aggregateOn">
> <value>OrderNumber</value>
> </simple-property-list>
> <property name="aggregateFunction">SUM</property>
> <list-property name="arguments">
> <structure>
> <property name="name">Expression</property>
> <expression name="value" type="javascript">row["ORDERNUMBER"]</expression>
> </structure>
> </list-property>
> </structure>
> </list-property>
> <column id="1096"/>
> <column id="1097"/>
> <header>
> <row id="1098">
> <cell id="1099">
> <label name="Order2" id="1101">
> <property name="fontWeight">bold</property>
> <text-property name="text">Order Details Table (Example 2)</text-property>
> </label>
> </cell>
> <cell id="1100"/>
> </row>
> <row id="1083">
> <cell id="1084">
> <label id="1085">
> <text-property name="text">ORDERNUMBER</text-property>
> </label>
> </cell>
> <cell id="1086">
> <label id="1087">
> <text-property name="text">QUANTITYORDERED</text-property>
> </label>
> </cell>
> </row>
> </header>
> <group id="1102">
> <property name="groupName">OrderNumber</property>
> <property name="interval">none</property>
> <property name="sortDirection">asc</property>
> <expression name="keyExpr"
> type="javascript">row["ORDERNUMBER"]</expression>
> <structure name="toc">
> <expression name="expressionValue"
> type="javascript">row["ORDERNUMBER"]</expression>
> </structure>
> <property name="repeatHeader">true</property>
> <property name="hideDetail">false</property>
> <property name="pageBreakAfter">auto</property>
> <property name="pageBreakBefore">auto</property>
> <property name="pageBreakInside">auto</property>
> <header>
> <row id="1103">
> <cell id="1104">
> <data id="1109">
> <property name="resultSetColumn">ORDERNUMBER</property>
> </data>
> </cell>
> <cell id="1105">
> <data id="1110">
> <property name="resultSetColumn">QUANTITYORDERED2</property>
> </data>
> </cell>
> </row>
> </header>
> </group>
> </table>
> </body>
> </report>


Jason Weathersby

BIRT Exchange
Re: User Defined Sort On Grouped Data [message #646618 is a reply to message #646556] Wed, 29 December 2010 05:52 Go to previous messageGo to next message
TicTac  is currently offline TicTac
Messages: 3
Registered: December 2010
Junior Member
Thanks for your reply Jason.

In table 1, with the group "NewTableGroup1", is it possible to sort on any column, while keeping the original grouping intact? If I wished to see only the group header with aggregated values (no underlying detail shown).

For example:
Col1 | Col2 | Col3 |Col4
ORDERNUMBER | SUM(QUANTITYORDERED) | SUM(PRICEEACH) | COUNT(ORDERLINENUMBER)

Is it possible to order by "Col2" while still grouping by "Col1"?

Thanks again.
David


Re: User Defined Sort On Grouped Data [message #646654 is a reply to message #646618] Wed, 29 December 2010 11:26 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

David,

Yes this can be done. First add aggregates to header and delete detail
row. Then use script to add a sort key to the group. Take a look at
the attached example.

Jason


<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
<property name="units">in</property>
<method
name="beforeFactory">< ![CDATA[importPackage(Packages.org.eclipse.birt.report.model .api);
importPackage(Packages.org.eclipse.birt.report.model.api.ele ments);
importPackage(Packages.java.util);

//First Table
delm = reportContext.getDesignHandle().findElement("mytable");
tgh = delm.getGroups().get(0);
//tgh.setSortDirection(params["sortorder"].value);
//Use this if you want to chage the group expression
//tgh.setKeyExpr("row[\"PRODUCTCODE\"]");

importPackage(Packages.com.ibm.icu.util);

var lc = new ULocale("fr_FR");
sc = StructureFactory.createSortKey();
sc.setKey("row[\""+params["SortOn"].value+"\"]");
sc.setDirection(params["SortOrder"].value);
sc.setLocale(lc);

ph = tgh.getPropertyHandle(TableHandle.SORT_PROP);
ph.addItem(sc);

]]></method>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<parameters>
<scalar-parameter name="SortOn" id="57">
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="distinct">true</property>
<list-property name="selectionList">
<structure>
<property name="value">qtyorderedAggregation</property>
<property name="label">Sum Quantity Ordered</property>
</structure>
<structure>
<property name="value">Aggregation</property>
<property name="label">Count Line Numbers</property>
</structure>
<structure>
<property
name="value">sumpriceeachAggregation</property>
<property name="label">Sum Price Each</property>
</structure>
</list-property>
<property name="paramType">simple</property>
<property name="controlType">list-box</property>
<property name="mustMatch">true</property>
<property name="fixedOrder">true</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
<scalar-parameter name="SortOrder" id="118">
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="distinct">true</property>
<list-property name="selectionList">
<structure>
<property name="value">asc</property>
<property name="label">Ascending</property>
</structure>
<structure>
<property name="value">desc</property>
<property name="label">Descending</property>
</structure>
</list-property>
<property name="paramType">simple</property>
<property name="controlType">list-box</property>
<property name="mustMatch">true</property>
<property name="fixedOrder">true</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</parameters>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="7">
<list-property name="privateDriverProperties">
<ex-property>
<name>contentBidiFormatStr</name>
<value>ILYNN</value>
</ex-property>
<ex-property>
<name>metadataBidiFormatStr</name>
<value>ILYNN</value>
</ex-property>
</list-property>
<property
name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="8">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<text-property
name="heading">ORDERNUMBER</text-property>
</structure>
<structure>
<property name="columnName">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<text-property
name="heading">PRODUCTCODE</text-property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<text-property
name="heading">QUANTITYORDERED</text-property>
</structure>
<structure>
<property name="columnName">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<text-property name="heading">PRICEEACH</text-property>
</structure>
<structure>
<property name="columnName">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<text-property
name="heading">ORDERLINENUMBER</text-property>
</structure>
</list-property>
<list-property name="filter">
<structure>
<property name="operator">lt</property>
<expression name="expr"
type="javascript">row["ORDERNUMBER"]</expression>
<simple-property-list name="value1">
<value>10205</value>
</simple-property-list>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="dataType">float</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">5</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select *
from orderdetails]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRODUCTCODE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRODUCTCODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRODUCTCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>QUANTITYORDERED</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>QUANTITYORDERED</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>QUANTITYORDERED</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRICEEACH</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRICEEACH</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRICEEACH</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERLINENUMBER</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>5</design:nativeDataTypeCode>
<design:precision>5</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERLINENUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERLINENUMBER</design:label>
<design:formattingHints>
<design:displaySize>6</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="table-header" id="99">
<property name="backgroundColor">#6078BF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="table-footer" id="100">
<property name="backgroundColor">#6078BF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="table-detail" id="101">
<property name="backgroundColor">#E6ECFF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">x-small</property>
<property name="fontWeight">bold</property>
<property name="color">#000080</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="table-group-header-1" id="102">
<property name="backgroundColor">#809FFF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="table-group-footer-1" id="103">
<property name="backgroundColor">#C0C0C0</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">x-small</property>
<property name="fontWeight">bold</property>
<property name="color">#000080</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="special-header" id="104">
<property name="backgroundColor">#6078BF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">medium</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="crosstab-detail" id="105">
<property name="backgroundColor">#E6ECFF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">x-small</property>
<property name="fontWeight">bold</property>
<property name="color">#000080</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="crosstab-header" id="106">
<property name="backgroundColor">#6078BF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="mydata" id="107">
<property name="color">orange</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table name="mytable" id="9">
<property name="width">7.947916666666667in</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<expression name="expression"
type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">qtyorderedAggregation</property>
<text-property
name="displayName">sumQTY</text-property>
<property name="dataType">float</property>
<simple-property-list name="aggregateOn">
<value>NewTableGroup1</value>
</simple-property-list>
<property name="aggregateFunction">SUM</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
<expression name="value"
type="javascript">row["QUANTITYORDERED"]</expression>
</structure>
</list-property>
</structure>
<structure>
<property
name="name">sumpriceeachAggregation</property>
<text-property
name="displayName">sumPrice</text-property>
<property name="dataType">float</property>
<simple-property-list name="aggregateOn">
<value>NewTableGroup1</value>
</simple-property-list>
<property name="aggregateFunction">SUM</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
<expression name="value"
type="javascript">row["PRICEEACH"]</expression>
</structure>
</list-property>
</structure>
<structure>
<property name="name">Aggregation</property>
<text-property
name="displayName">countLineNumber</text-property>
<property name="dataType">integer</property>
<simple-property-list name="aggregateOn">
<value>NewTableGroup1</value>
</simple-property-list>
<property name="aggregateFunction">COUNT</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
<expression name="value"
type="javascript">row["ORDERLINENUMBER"]</expression>
</structure>
</list-property>
</structure>
</list-property>
<column id="38">
<property name="width">1.3020833333333333in</property>
</column>
<column id="39">
<property name="width">1.1875in</property>
</column>
<column id="40">
<property name="width">1.6041666666666667in</property>
</column>
<column id="41">
<property name="width">1.5416666666666667in</property>
</column>
<column id="42">
<property name="width">2.3125in</property>
</column>
<header>
<row id="58">
<cell id="59">
<property name="colSpan">5</property>
<property name="rowSpan">1</property>
<label id="64">
<text-property name="text">This table's
group sorting is modified in the before factory</text-property>
</label>
</cell>
</row>
<row id="10">
<cell id="11">
<label id="12">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="13">
<label id="14">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="15">
<label id="16">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="17">
<label id="18">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="19">
<label id="20">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<group id="43">
<property name="groupName">NewTableGroup1</property>
<property name="interval">none</property>
<property name="sortDirection">desc</property>
<expression name="keyExpr"
type="javascript">row["ORDERNUMBER"]</expression>
<structure name="toc">
<expression name="expressionValue"
type="javascript">row["ORDERNUMBER"]</expression>
</structure>
<property name="repeatHeader">true</property>
<property name="hideDetail">false</property>
<property name="pageBreakAfter">auto</property>
<property name="pageBreakBefore">auto</property>
<property name="pageBreakInside">auto</property>
<header>
<row id="44">
<cell id="45">
<data id="56">
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="46"/>
<cell id="47">
<data id="115">
<property
name="resultSetColumn">qtyorderedAggregation</property>
</data>
</cell>
<cell id="48">
<data id="116">
<structure name="numberFormat">
<property
name="category">Fixed</property>
<property
name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
</structure>
<property
name="resultSetColumn">sumpriceeachAggregation</property>
</data>
</cell>
<cell id="49">
<data id="117">
<property
name="resultSetColumn">Aggregation</property>
</data>
</cell>
</row>
</header>
<footer>
<row id="50">
<cell id="51"/>
<cell id="52"/>
<cell id="53"/>
<cell id="54"/>
<cell id="55"/>
</row>
</footer>
</group>
<footer>
<row id="32">
<cell id="33"/>
<cell id="34"/>
<cell id="35"/>
<cell id="36"/>
<cell id="37"/>
</row>
</footer>
</table>
</body>
</report>


On 12/29/2010 5:52 AM, TicTac wrote:
> Thanks for your reply Jason.
>
> In table 1, with the group "NewTableGroup1", is it possible to sort on
> any column, while keeping the original grouping intact? If I wished to
> see only the group header with aggregated values (no underlying detail
> shown).
> For example:
> Col1 | Col2 | Col3 |Col4
> ORDERNUMBER | SUM(QUANTITYORDERED) | SUM(PRICEEACH) |
> COUNT(ORDERLINENUMBER)
>
> Is it possible to order by "Col2" while still grouping by "Col1"?
>
> Thanks again.
> David
>
>
>


Jason Weathersby

BIRT Exchange
Re: User Defined Sort On Grouped Data [message #646702 is a reply to message #646654] Thu, 30 December 2010 04:15 Go to previous message
TicTac  is currently offline TicTac
Messages: 3
Registered: December 2010
Junior Member
Many thanks Jason!

This is *exactly* what I was looking for.

Regards,
David
Previous Topic:Alignment of labels for meter chart
Next Topic:Report Query Parameters
Goto Forum:
  


Current Time: Thu Apr 24 01:34:40 EDT 2014

Powered by FUDForum. Page generated in 0.27639 seconds