Home » Archived » BIRT » Sort Table
|
Re: Sort Table [message #668680 is a reply to message #668538] |
Fri, 06 May 2011 16:55 |
|
Edi,
If the table is presented on more than one html page the report will
have to be re-executed. If if is on one page you can sort the dom. I
am attaching an example that re-sorts the whole report by re-running it.
Jason
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.15"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.2.1.r221_v20070924 Build <2.2.0.v20070924-1550></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2006 <<Your Company
Name here>></property>
<parameters>
<scalar-parameter name="srt" id="88">
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="paramType">simple</property>
<property name="isRequired">true</property>
<property name="controlType">text-box</property>
<property name="defaultValue">a</property>
<property name="distinct">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="4">
<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>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source1"
id="115">
<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="5">
<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>
<structure>
<property name="position">3</property>
<property name="name">CONTACTLASTNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">CONTACTFIRSTNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">PHONE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">6</property>
<property name="name">ADDRESSLINE1</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">7</property>
<property name="name">ADDRESSLINE2</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">8</property>
<property name="name">CITY</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">9</property>
<property name="name">STATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">10</property>
<property name="name">POSTALCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">11</property>
<property name="name">COUNTRY</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">12</property>
<property
name="name">SALESREPEMPLOYEENUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">13</property>
<property name="name">CREDITLIMIT</property>
<property name="dataType">float</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>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CUSTOMERNAME</property>
<property name="nativeName">CUSTOMERNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">CONTACTLASTNAME</property>
<property name="nativeName">CONTACTLASTNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">CONTACTFIRSTNAME</property>
<property name="nativeName">CONTACTFIRSTNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">PHONE</property>
<property name="nativeName">PHONE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">6</property>
<property name="name">ADDRESSLINE1</property>
<property name="nativeName">ADDRESSLINE1</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">7</property>
<property name="name">ADDRESSLINE2</property>
<property name="nativeName">ADDRESSLINE2</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">8</property>
<property name="name">CITY</property>
<property name="nativeName">CITY</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">9</property>
<property name="name">STATE</property>
<property name="nativeName">STATE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">10</property>
<property name="name">POSTALCODE</property>
<property name="nativeName">POSTALCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">11</property>
<property name="name">COUNTRY</property>
<property name="nativeName">COUNTRY</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">12</property>
<property name="name">SALESREPEMPLOYEENUMBER</property>
<property
name="nativeName">SALESREPEMPLOYEENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">13</property>
<property name="name">CREDITLIMIT</property>
<property name="nativeName">CREDITLIMIT</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
</list-property>
<property name="queryText">select *
from CLASSICMODELS.CUSTOMERS</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: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: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: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: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: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: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: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: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: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: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: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: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:attributes>
<design:usageHints>
<design:label>CREDITLIMIT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNAME</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTLASTNAME</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTFIRSTNAME</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PHONE</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ADDRESSLINE1</design:name>
<design:position>6</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ADDRESSLINE2</design:name>
<design:position>7</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CITY</design:name>
<design:position>8</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>STATE</design:name>
<design:position>9</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>POSTALCODE</design:name>
<design:position>10</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>COUNTRY</design:name>
<design:position>11</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>SALESREPEMPLOYEENUMBER</design:name>
<design:position>12</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CREDITLIMIT</design:name>
<design:position>13</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="detail" id="89">
<property name="backgroundColor">#FFFF80</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
</style>
<style name="headerfooter" id="90">
<property name="backgroundColor">#004080</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
</style>
<style name="groupheader" id="91">
<property name="backgroundColor">#0080FF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</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>
<text id="92">
<list-property name="visibility">
<structure>
<property name="format">pdf</property>
<expression name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property name="content"><![CDATA[
<form name="input" onSubmit="return reloadPage();">
<script type="text/javascript">
function reloadPage(sorton) {
//alert("Reload time");
var temp = new String(location.href);
var targetURL = new String();
if(temp.indexOf("__overwrite=") != -1 ){
targetURL = temp.substring(0, temp.indexOf("&__overwrite") -1);
}else{
targetURL = temp;
}
targetURL += "&__overwrite=true";
targetURL += "&srt=" + sorton;
//alert( targetURL );
location.replace(targetURL);
return false;
}
</script>
</form>]]></text-property>
</text>
<table name="mytable" id="6">
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">CUSTOMERNUMBER</property>
<expression
name="expression">dataSetRow["CUSTOMERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">CUSTOMERNAME</property>
<expression
name="expression">dataSetRow["CUSTOMERNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CONTACTLASTNAME</property>
<expression
name="expression">dataSetRow["CONTACTLASTNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CONTACTFIRSTNAME</property>
<expression
name="expression">dataSetRow["CONTACTFIRSTNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">PHONE</property>
<expression
name="expression">dataSetRow["PHONE"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">ADDRESSLINE1</property>
<expression
name="expression">dataSetRow["ADDRESSLINE1"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">ADDRESSLINE2</property>
<expression
name="expression">dataSetRow["ADDRESSLINE2"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CITY</property>
<expression
name="expression">dataSetRow["CITY"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">STATE</property>
<expression
name="expression">dataSetRow["STATE"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">POSTALCODE</property>
<expression
name="expression">dataSetRow["POSTALCODE"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">COUNTRY</property>
<expression
name="expression">dataSetRow["COUNTRY"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">SALESREPEMPLOYEENUMBER</property>
<expression
name="expression">dataSetRow["SALESREPEMPLOYEENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">CREDITLIMIT</property>
<expression
name="expression">dataSetRow["CREDITLIMIT"]</expression >
<property name="dataType">float</property>
</structure>
</list-property>
<list-property name="sort">
<structure>
<expression name="key">if( params["srt"].value ==
"a" ){
row["CUSTOMERNAME"];
} else if( params["srt"].value == "b"){
row["CONTACTLASTNAME"];
} else if( params["srt"].value == "c"){
row["CONTACTFIRSTNAME"];
} else if( params["srt"].value == "d"){
row["PHONE"];
} else if( params["srt"].value == "e"){
row["ADDRESSLINE1"];
} else if( params["srt"].value == "f"){
row["ADDRESSLINE2"];
} else if( params["srt"].value == "g"){
row["CITY"];
} else if( params["srt"].value == "h"){
row["STATE"];
}</expression>
<property name="direction">asc</property>
</structure>
</list-property>
<column id="75"/>
<column id="76"/>
<column id="77"/>
<column id="78"/>
<column id="79"/>
<column id="80"/>
<column id="81"/>
<column id="82"/>
<column id="83"/>
<column id="85"/>
<column id="87"/>
<header>
<row id="93">
<property name="style">headerfooter</property>
<cell id="94"/>
<cell id="95">
<text id="107">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property
name="format">postscript</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">xls</property>
<expression
name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="reloadPage('a')" >
]]></text-property>
</text>
</cell>
<cell id="96">
<text id="108">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property
name="format">postscript</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">xls</property>
<expression
name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="reloadPage('b')" >
]]></text-property>
</text>
</cell>
<cell id="97">
<text id="109">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property
name="format">postscript</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">xls</property>
<expression
name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="reloadPage('c')" >
]]></text-property>
</text>
</cell>
<cell id="98">
<text id="110">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property
name="format">postscript</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">xls</property>
<expression
name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="reloadPage('d')" >
]]></text-property>
</text>
</cell>
<cell id="99">
<text id="111">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property
name="format">postscript</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">xls</property>
<expression
name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="reloadPage('e')" >
]]></text-property>
</text>
</cell>
<cell id="100">
<text id="112">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property
name="format">postscript</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">xls</property>
<expression
name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="reloadPage('f')" >
]]></text-property>
</text>
</cell>
<cell id="101">
<text id="113">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property
name="format">postscript</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">xls</property>
<expression
name="valueExpr">true</expression>
</structure>
</list-property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="reloadPage('g')" >
]]></text-property>
</text>
</cell>
<cell id="102">
<text id="114">
<list-property name="visibility">
<structure>
<property name="format">doc</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">ppt</property>
<expression
name="valueExpr">true</expression>
</structure>
<structure>
<property name="format">pdf</property>
<expression
name="valueExpr">true</expression>
|
|
| |
Re: Sort Table [message #669800 is a reply to message #669668] |
Wed, 11 May 2011 14:40 |
|
Edi,
To get that sample to work just remove the build number: Build
<2.2.0.v20070924-1550 in the xml view of the report. I have an
example of sorting without re-running but it only works in html. It is
attached.
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="comments">Copyright (c) 2007 <<Your Company
Name here>></property>
<property name="createdBy">Eclipse BIRT Designer Version
2.6.1.v20100902 Build <2.6.1.v20100915-1750></property>
<html-property name="description">Creates a blank report with no
predefined content.</html-property>
<property name="units">in</property>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="layoutPreference">auto layout</property>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="6">
<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="7">
<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>
<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>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select *
from orderdetails
where ordernumber < 10103
]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="crosstab-cell" id="4">
<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="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="detail" id="48">
<property name="backgroundColor">#BACAE2</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="headerfooter" id="49">
<property name="backgroundColor">#004080</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
</style>
<style name="groupheader" id="50">
<property name="backgroundColor">#0080FF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<property name="topMargin">1in</property>
<property name="leftMargin">1.25in</property>
<property name="bottomMargin">1in</property>
<property name="rightMargin">1.25in</property>
<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>
<text id="42">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<script>
var sortcol =2;
var testArray = new Array();
function tableSort(a, b) {
var x = a.cells[sortcol].innerHTML.toLowerCase();
var y = b.cells[sortcol].innerHTML.toLowerCase();
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}
function rowCopy( a, b ){
cellcnt = b.cells.length;
//alert("A = "+ a.innerHTML);
//alert("B = "+ b.innerHTML);
for( ii=0; ii<cellcnt; ii++ ){
b.cells[ii].innerHTML = a.cells[ii].innerHTML;
}
}
function sortTable(id, col, rev) {
sortcol = col;
var tbl = document.getElementById(id);
var ctbl = tbl.cloneNode(true);
//alert( ctbl.rows[0].cells[0].innerHTML );
var tRows = ctbl.rows
var ctRows = tbl.rows
//var testArray = new Array(tRows.length-2);
//var testArray = cloneObject(tRows);
for( var i =1; i < tRows.length-1; i++ ){
testArray[i-1] = tRows[i];
}
testArray.sort( tableSort );
for( var x = 0; x < testArray.length; x++ ){
rowCopy( testArray[x], ctRows[x+1] );
}
}
</script>
]]></text-property>
</text>
<table name="MyTable" id="8">
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<expression
name="expression">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<expression
name="expression">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<expression
name="expression">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<expression
name="expression">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<expression
name="expression">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<expression name="bookmark">"MyTable"</expression>
<property name="pageBreakInterval">50</property>
<column id="37"/>
<column id="38"/>
<column id="39"/>
<column id="40"/>
<column id="41"/>
<header>
<row id="9">
<property name="style">headerfooter</property>
<cell id="10">
<label id="11">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
<text id="43">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="sortTable('MyTable', 0, 1)">]]></text-property>
</text>
</cell>
<cell id="12">
<label id="13">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
<text id="44">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="sortTable('MyTable', 1, 1)">]]></text-property>
</text>
</cell>
<cell id="14">
<label id="15">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
<text id="45">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="sortTable('MyTable', 2, 1)">]]></text-property>
</text>
</cell>
<cell id="16">
<label id="17">
<text-property
name="text">PRICEEACH</text-property>
</label>
<text id="46">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="sortTable('MyTable', 3, 1)">]]></text-property>
</text>
</cell>
<cell id="18">
<label id="19">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
<text id="47">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<input type="button" value="Sort"
onclick="sortTable('MyTable', 4, 1)">]]></text-property>
</text>
</cell>
</row>
</header>
<detail>
<row id="20">
<property name="style">detail</property>
<cell id="21">
<data id="22">
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="23">
<data id="24">
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="25">
<data id="26">
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="27">
<data id="28">
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="29">
<data id="30">
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="31">
<cell id="32"/>
<cell id="33"/>
<cell id="34"/>
<cell id="35"/>
<cell id="36"/>
</row>
</footer>
</table>
</body>
</report>
On 5/11/2011 2:00 AM, Edi wrote:
> Hi Jason, Thank you for your Help.
>
> I tried to copy the xml code in a new report in BIRT, but i
> get an error message: "Error in XML Source Page must be corrected before
> other
> pages can be used" ???
>
> The other point is, that I mustn't reload the whole report
> to sort one table. Is there a way to sort the table without
> reload the whole report?
>
> Thank you
>
> Edi
|
|
| | | |
Re: Sort Table [message #671608 is a reply to message #670346] |
Wed, 18 May 2011 13:16 |
Edi Messages: 19 Registered: November 2010 |
Junior Member |
|
|
I have found a script that do exactly that what I'm looking for in a normal HTML website.
How i can use this script in BIRT for a report?
<script>
var stIsIE = /*@cc_on!@*/false;
sorttable = {
init: function() {
// quit if this function already been called
if (arguments.callee.done) return;
// flag this fthisunction so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (_timer) clearInterval(_timer);
if (!document.createElement || !document.getElementsByTagName) return;
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
forEach(document.getElementsByTagName('table'), function(table) {
if (table.className.search(/\bsortable\b/) != -1) {
sorttable.makeSortable(table);
}
});
},
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
the = document.createElement('thead');
the.appendChild(table.rows[0]);
table.insertBefore(the,table.firstChild);
}
// Safari doesn't support table.tHead, sigh
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
// "total" rows, for example). This is B&R, since what you're supposed
// to do is put them in a tfoot. So, if there are sortbottom rows,
// for backwards compatibility, move them to tfoot (creating it if needed).
sortbottomrows = [];
for (var i=0; i<table.rows.length; i++) {
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
sortbottomrows[sortbottomrows.length] = table.rows[i];
}
}
if (sortbottomrows) {
if (table.tFoot == null) {
// table doesn't have a tfoot. Create one.
tfo = document.createElement('tfoot');
table.appendChild(tfo);
}
for (var i=0; i<sortbottomrows.length; i++) {
tfo.appendChild(sortbottomrows[i]);
}
delete sortbottomrows;
}
// work through each column and calculate its type
headrow = table.tHead.rows[0].cells;
for (var i=0; i<headrow.length; i++) {
// manually override the type with a sorttable_type attribute
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
if (mtch) { override = mtch[1]; }
if (mtch && typeof sorttable["sort_"+override] == 'function') {
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
} else {
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
}
// make it clickable to sort
headrow[i].sorttable_columnindex = i;
headrow[i].sorttable_tbody = table.tBodies[0];
dean_addEvent(headrow[i],"click", function(e) {
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
// if we're already sorted by this column, just
// reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted',
'sorttable_sorted_reverse');
this.removeChild(document.getElementById('sorttable_sortfwdind'));
sortrevind = document.createElement('span');
sortrevind.id = "sorttable_sortrevind";
sortrevind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▴';
this.appendChild(sortrevind);
return;
}
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
// if we're already sorted by this column in reverse, just
// re-reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted_reverse',
'sorttable_sorted');
this.removeChild(document.getElementById('sorttable_sortrevind'));
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
this.appendChild(sortfwdind);
return;
}
// remove sorttable_sorted classes
theadrow = this.parentNode;
forEach(theadrow.childNodes, function(cell) {
if (cell.nodeType == 1) { // an element
cell.className = cell.className.replace('sorttable_sorted_reverse','');
cell.className = cell.className.replace('sorttable_sorted','');
}
});
sortfwdind = document.getElementById('sorttable_sortfwdind');
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
sortrevind = document.getElementById('sorttable_sortrevind');
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
this.className += ' sorttable_sorted';
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
this.appendChild(sortfwdind);
// build an array to sort. This is a Schwartzian transform thing,
// i.e., we "decorate" each row with the actual sort key,
// sort based on the sort keys, and then put the rows back in order
// which is a lot faster because you only do getInnerText once per row
row_array = [];
col = this.sorttable_columnindex;
rows = this.sorttable_tbody.rows;
for (var j=0; j<rows.length; j++) {
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
}
/* If you want a stable sort, uncomment the following line */
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
/* and comment out this one */
row_array.sort(this.sorttable_sortfunction);
tb = this.sorttable_tbody;
for (var j=0; j<row_array.length; j++) {
tb.appendChild(row_array[j][1]);
}
delete row_array;
});
}
}
},
guessType: function(table, column) {
// guess the type of a column based on its first non-blank row
sortfn = sorttable.sort_alpha;
for (var i=0; i<table.tBodies[0].rows.length; i++) {
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
if (text != '') {
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
return sorttable.sort_numeric;
}
// check for a date: dd/mm/yyyy or dd/mm/yy
// can have / or . or - as separator
// can be mm/dd as well
possdate = text.match(sorttable.DATE_RE)
if (possdate) {
// looks like a date
first = parseInt(possdate[1]);
second = parseInt(possdate[2]);
if (first > 12) {
// definitely dd/mm
return sorttable.sort_ddmm;
} else if (second > 12) {
return sorttable.sort_mmdd;
} else {
// looks like a date, but we can't tell which, so assume
// that it's dd/mm (English imperialism!) and keep looking
sortfn = sorttable.sort_ddmm;
}
}
}
}
return sortfn;
},
getInnerText: function(node) {
// gets the text we want to use for sorting for a cell.
// strips leading and trailing whitespace.
// this is *not* a generic getInnerText function; it's special to sorttable.
// for example, you can override the cell text with a customkey attribute.
// it also gets .value for <input> fields.
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;
if (node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
}
else if (typeof node.textContent != 'undefined' && !hasInputs) {
return node.textContent.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.innerText != 'undefined' && !hasInputs) {
return node.innerText.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.text != 'undefined' && !hasInputs) {
return node.text.replace(/^\s+|\s+$/g, '');
}
else {
switch (node.nodeType) {
case 3:
if (node.nodeName.toLowerCase() == 'input') {
return node.value.replace(/^\s+|\s+$/g, '');
}
case 4:
return node.nodeValue.replace(/^\s+|\s+$/g, '');
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += sorttable.getInnerText(node.childNodes[i]);
}
return innerText.replace(/^\s+|\s+$/g, '');
break;
default:
return '';
}
}
},
reverse: function(tbody) {
// reverse the rows in a tbody
newrows = [];
for (var i=0; i<tbody.rows.length; i++) {
newrows[newrows.length] = tbody.rows[i];
}
for (var i=newrows.length-1; i>=0; i--) {
tbody.appendChild(newrows[i]);
}
delete newrows;
},
/* sort functions
each sort function takes two parameters, a and b
you are comparing a[0] and b[0] */
sort_numeric: function(a,b) {
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
if (isNaN(aa)) aa = 0;
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
if (isNaN(bb)) bb = 0;
return aa-bb;
},
sort_alpha: function(a,b) {
if (a[0]==b[0]) return 0;
if (a[0]<b[0]) return -1;
return 1;
},
sort_ddmm: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
sort_mmdd: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
shaker_sort: function(list, comp_func) {
// A stable sort function to allow multi-level sorting of data
// see: http://en.wikipedia.org/wiki/Cocktail_sort
// thanks to Joseph Nahmias
var b = 0;
var t = list.length - 1;
var swap = true;
while(swap) {
swap = false;
for(var i = b; i < t; ++i) {
if ( comp_func(list[i], list[i+1]) > 0 ) {
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
swap = true;
}
} // for
t--;
if (!swap) break;
for(var i = t; i > b; --i) {
if ( comp_func(list[i], list[i-1]) < 0 ) {
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
swap = true;
}
} // for
b++;
} // while(swap)
}
}
/* ******************************************************************
Supporting functions: bundled here to avoid depending on a library
****************************************************************** */
// Dean Edwards/Matthias Miller/John Resig
/* for Mozilla/Opera9 */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", sorttable.init, false);
}
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
sorttable.init(); // call the onload handler
}
};
/*@end @*/
/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
var _timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
sorttable.init(); // call the onload handler
}
}, 10);
}
/* for other browsers */
window.onload = sorttable.init;
// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
// http://dean.edwards.name/weblog/2005/10/add-event/
function dean_addEvent(element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else {
// assign each event handler a unique ID
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
// create a hash table of event types for the element
if (!element.events) element.events = {};
// create a hash table of event handlers for each element/event pair
var handlers = element.events[type];
if (!handlers) {
handlers = element.events[type] = {};
// store the existing event handler (if there is one)
if (element["on" + type]) {
handlers[0] = element["on" + type];
}
}
// store the event handler in the hash table
handlers[handler.$$guid] = handler;
// assign a global event handler to do all the work
element["on" + type] = handleEvent;
}
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;
function removeEvent(element, type, handler) {
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else {
// delete the event handler from the hash table
if (element.events && element.events[type]) {
delete element.events[type][handler.$$guid];
}
}
};
function handleEvent(event) {
var returnValue = true;
// grab the event object (IE uses a global event object)
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
// get a reference to the hash table of event handlers
var handlers = this.events[event.type];
// execute each event handler
for (var i in handlers) {
this.$$handleEvent = handlers[i];
if (this.$$handleEvent(event) === false) {
returnValue = false;
}
}
return returnValue;
};
function fixEvent(event) {
// add W3C standard event methods
event.preventDefault = fixEvent.preventDefault;
event.stopPropagation = fixEvent.stopPropagation;
return event;
};
fixEvent.preventDefault = function() {
this.returnValue = false;
};
fixEvent.stopPropagation = function() {
this.cancelBubble = true;
}
// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
forEach, version 1.0
Copyright 2006, Dean Edwards
License: http://www.opensource.org/licenses/mit-license.php
*/
// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
Array.forEach = function(array, block, context) {
for (var i = 0; i < array.length; i++) {
block.call(context, array[i], i, array);
}
};
}
// generic enumeration
Function.prototype.forEach = function(object, block, context) {
for (var key in object) {
if (typeof this.prototype[key] == "undefined") {
block.call(context, object[key], key, object);
}
}
};
// character enumeration
String.forEach = function(string, block, context) {
Array.forEach(string.split(""), function(chr, index) {
block.call(context, chr, index, string);
});
};
// globally resolve forEach enumeration
var forEach = function(object, block, context) {
if (object) {
var resolve = Object; // default
if (object instanceof Function) {
// functions have a "length" property
resolve = Function;
} else if (object.forEach instanceof Function) {
// the object implements a custom forEach method so use that
object.forEach(block, context);
return;
} else if (typeof object == "string") {
// the object is a string
resolve = String;
} else if (typeof object.length == "number") {
// the object is array-like
resolve = Array;
}
resolve.forEach(object, block, context);
}
};
</script>
|
|
|
Re: Sort Table [message #671641 is a reply to message #671608] |
Wed, 18 May 2011 14:42 |
|
Keith,
Sorry I did not see your reply. I have an example of resorting that handles pagination but it requires re-running the report.
Jason
|
|
|
Re: Sort Table [message #671643 is a reply to message #671641] |
Wed, 18 May 2011 14:44 |
|
Edi,
Can you post your original report where you had issues including the code I sent you? It should be much simpler than adding all the script you posted. BTW you can include client side javascript using the <script> tag in a text element.
Jason
|
|
|
Re: Sort Table [message #674220 is a reply to message #671643] |
Thu, 26 May 2011 08:10 |
Edi Messages: 19 Registered: November 2010 |
Junior Member |
|
|
Hi Jason,
Here is the 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 <2.6.1.v20100915-1750></property>
<property name="units">in</property>
<list-property name="propertyBindings">
<structure>
<property name="name">queryText</property>
<property name="id">78</property>
</structure>
<structure>
<property name="name">queryTimeOut</property>
<property name="id">78</property>
</structure>
</list-property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<parameters>
<scalar-parameter name="fromYear" id="25">
<text-property name="promptText">From</text-property>
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="distinct">true</property>
<list-property name="selectionList">
<structure>
<property name="value">1-JAN-2009</property>
<property name="label">2009</property>
</structure>
<structure>
<property name="value">1-JAN-2010</property>
<property name="label">2010</property>
</structure>
<structure>
<property name="value">1-JAN-2011</property>
<property name="label">2011</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="toYear" id="26">
<text-property name="promptText">From</text-property>
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="constant">1-JAN-2009</value>
</simple-property-list>
<list-property name="selectionList">
<structure>
<property name="value">1-JAN-2009</property>
<property name="label">2009</property>
</structure>
<structure>
<property name="value">1-JAN-2010</property>
<property name="label">2010</property>
</structure>
<structure>
<property name="value">1-JAN-2011</property>
<property name="label">2011</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="ERM" id="23">
<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">oracle.jdbc.OracleDriver</property>
<property name="odaURL">jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=chbsux1001.eu.novartis.net)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=erm_ch)))</property>
<property name="odaUser">erm_read</property>
<encrypted-property name="odaPassword" encryptionID="base64">ZXJtX3JlYWQ=</encrypted-property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="CCperMonthbyStockroom" id="24">
<list-property name="parameters">
<structure>
<property name="name">p_fromYear</property>
<property name="paramName">fromYear</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">p_toYear</property>
<property name="paramName">toYear</property>
<property name="dataType">string</property>
<property name="position">2</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">STOCKROOM</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">ERM</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="nativeName">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="nativeName">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="nativeName">LOCATION</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">STOCKROOM</property>
<property name="nativeName">STOCKROOM</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select count(containerid) container_count, CDATE, location, max(stockroom) as stockroom
from (
SELECT containerid,
TO_CHAR(trunc(CREATIONDATE, 'Q'),'YYYY-Q') CDATE ,
SITE || '->' || BUILDING || '->' || N.FLOOR || '->' || N.ROOM as location,
stockroom
FROM ERM.NOVARTIS_CONTAINER_CREATED N
where CREATIONDATE >= ?
AND CREATIONDATE < ?
)
group by CDATE, location, stockroom
order by 2 desc,3]]></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>CONTAINER_COUNT</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>2</design:nativeDataTypeCode>
<design:precision>0</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTAINER_COUNT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTAINER_COUNT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CDATE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>7</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CDATE</design:label>
<design:formattingHints>
<design:displaySize>7</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>LOCATION</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>134</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>LOCATION</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>LOCATION</design:label>
<design:formattingHints>
<design:displaySize>134</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="CCperQuarterbyBuilding" id="79">
<list-property name="parameters">
<structure>
<property name="name">p_fromYear</property>
<property name="paramName">fromYear</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">p_toYear</property>
<property name="paramName">toYear</property>
<property name="dataType">string</property>
<property name="position">2</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">ERM</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="nativeName">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="nativeName">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="nativeName">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select count(containerid) container_count, CDATE, location -- , max(stockroom) as stockroom
from (
SELECT containerid,
TO_CHAR(trunc(CREATIONDATE, 'YEAR'),'YYYY') CDATE ,
SITE || '->' || BUILDING as location,
stockroom
FROM ERM.NOVARTIS_CONTAINER_CREATED N
where CREATIONDATE >= ?
AND CREATIONDATE < ?
)
group by CDATE, location
order by 2 desc,3]]></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>CONTAINER_COUNT</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>2</design:nativeDataTypeCode>
<design:precision>0</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTAINER_COUNT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTAINER_COUNT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CDATE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>7</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CDATE</design:label>
<design:formattingHints>
<design:displaySize>7</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>LOCATION</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>134</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>LOCATION</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>LOCATION</design:label>
<design:formattingHints>
<design:displaySize>134</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="CCperQuarterbyFloor" id="80">
<list-property name="parameters">
<structure>
<property name="name">p_fromYear</property>
<property name="paramName">fromYear</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">p_toYear</property>
<property name="paramName">toYear</property>
<property name="dataType">string</property>
<property name="position">2</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">ERM</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="nativeName">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="nativeName">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="nativeName">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select count(containerid) container_count, CDATE, location -- , max(stockroom) as stockroom
from (
SELECT containerid,
TO_CHAR(trunc(CREATIONDATE, 'Q'),'YYYY-Q') CDATE ,
SITE || '->' || BUILDING || '->' || N.FLOOR as location,
stockroom
FROM ERM.NOVARTIS_CONTAINER_CREATED N
where CREATIONDATE >= ?
AND CREATIONDATE < ?
)
group by CDATE, location
order by 2 desc,3]]></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>CONTAINER_COUNT</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>2</design:nativeDataTypeCode>
<design:precision>0</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTAINER_COUNT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTAINER_COUNT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CDATE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>7</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CDATE</design:label>
<design:formattingHints>
<design:displaySize>7</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>LOCATION</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>134</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>LOCATION</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>LOCATION</design:label>
<design:formattingHints>
<design:displaySize>134</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="CCperQuarterbySite" id="81">
<list-property name="parameters">
<structure>
<property name="name">p_fromYear</property>
<property name="paramName">fromYear</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">p_toYear</property>
<property name="paramName">toYear</property>
<property name="dataType">string</property>
<property name="position">2</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">ERM</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="nativeName">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="nativeName">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="nativeName">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select count(containerid) container_count, CDATE, location -- , max(stockroom) as stockroom
from (
SELECT containerid,
TO_CHAR(trunc(CREATIONDATE, 'YEAR'),'YYYY') CDATE ,
SITE as location,
stockroom
FROM ERM.NOVARTIS_CONTAINER_CREATED N
where CREATIONDATE >= ?
AND CREATIONDATE < ?
)
group by CDATE, location
order by 2 desc,3]]></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>CONTAINER_COUNT</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>2</design:nativeDataTypeCode>
<design:precision>0</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTAINER_COUNT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTAINER_COUNT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CDATE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>7</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CDATE</design:label>
<design:formattingHints>
<design:displaySize>7</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>LOCATION</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>134</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>LOCATION</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>LOCATION</design:label>
<design:formattingHints>
<design:displaySize>134</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="CCperQuarterbyStockroom" id="82">
<list-property name="parameters">
<structure>
<property name="name">p_fromYear</property>
<property name="paramName">fromYear</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">p_toYear</property>
<property name="paramName">toYear</property>
<property name="dataType">string</property>
<property name="position">2</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">STOCKROOM</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">ERM</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="nativeName">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="nativeName">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="nativeName">LOCATION</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">STOCKROOM</property>
<property name="nativeName">STOCKROOM</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select count(containerid) container_count, CDATE, location, max(stockroom) as stockroom
from (
SELECT containerid,
TO_CHAR(trunc(CREATIONDATE, 'Q'),'YYYY-Q') CDATE ,
SITE || '->' || BUILDING || '->' || N.FLOOR || '->' || N.ROOM as location,
stockroom
FROM ERM.NOVARTIS_CONTAINER_CREATED N
where CREATIONDATE >= ?
AND CREATIONDATE < ?
)
group by CDATE, location, stockroom
order by 2 desc,3]]></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>CONTAINER_COUNT</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>2</design:nativeDataTypeCode>
<design:precision>0</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTAINER_COUNT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTAINER_COUNT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CDATE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>7</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CDATE</design:label>
<design:formattingHints>
<design:displaySize>7</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>LOCATION</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>134</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>LOCATION</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>LOCATION</design:label>
<design:formattingHints>
<design:displaySize>134</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="CCperYearbyBuilding" id="75">
<list-property name="parameters">
<structure>
<property name="name">p_fromYear</property>
<property name="paramName">fromYear</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">p_toYear</property>
<property name="paramName">toYear</property>
<property name="dataType">string</property>
<property name="position">2</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">ERM</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="nativeName">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="nativeName">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="nativeName">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select count(containerid) container_count, CDATE, location -- , max(stockroom) as stockroom
from (
SELECT containerid,
TO_CHAR(trunc(CREATIONDATE, 'MONTH'),'YYYY-MM') CDATE ,
SITE || '->' || BUILDING as location,
stockroom
FROM ERM.NOVARTIS_CONTAINER_CREATED N
where CREATIONDATE >= ?
AND CREATIONDATE < ?
)
group by CDATE, location
order by 2 desc,3]]></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>CONTAINER_COUNT</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>2</design:nativeDataTypeCode>
<design:precision>0</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTAINER_COUNT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTAINER_COUNT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CDATE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>7</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CDATE</design:label>
<design:formattingHints>
<design:displaySize>7</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>LOCATION</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>134</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>LOCATION</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>LOCATION</design:label>
<design:formattingHints>
<design:displaySize>134</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="CCperYearbyFloor" id="76">
<list-property name="parameters">
<structure>
<property name="name">p_fromYear</property>
<property name="paramName">fromYear</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">p_toYear</property>
<property name="paramName">toYear</property>
<property name="dataType">string</property>
<property name="position">2</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">ERM</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CONTAINER_COUNT</property>
<property name="nativeName">CONTAINER_COUNT</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CDATE</property>
<property name="nativeName">CDATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">LOCATION</property>
<property name="nativeName">LOCATION</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select count(containerid) container_count, CDATE, location -- , max(stockroom) as stockroom
from (
SELECT containerid,
TO_CHAR(trunc(CREATIONDATE, 'MONTH'),'YYYY-MM') CDATE ,
SITE || '->' || BUILDING || '->' || N.FLOOR as location,
stockroom
FROM ERM.NOVARTIS_CONTAINER_CREATED N
where CREATIONDATE >= ?
AND CREATIONDATE < ?
)
group by CDATE, location
order by 2 desc,3]]></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>CONTAINER_COUNT</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>2</design:nativeDataTypeCode>
<design:precision>0</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTAINER_COUNT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTAINER_COUNT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CDATE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>7</design:precision>
<design:scale>0</design:scale>
<des
[Updated on: Thu, 26 May 2011 08:13] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Apr 19 13:05:01 GMT 2024
Powered by FUDForum. Page generated in 0.02921 seconds
|