Home » Archived » BIRT » Balance sheet dynamic crosstab: how to sum up to date rather than between dates
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #685435 is a reply to message #685331] |
Fri, 17 June 2011 14:06 |
|
Tomas has a good idea, but if you can not do that you can always use
script in the crosstab to create your own running sum. Take a look at
the attached example. Look at the data item with the background color
of red.
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>
<list-property name="userProperties">
<structure>
<property name="name">salesbydate.dsOrders.x</property>
<property name="type">integer</property>
<property name="isVisible">false</property>
</structure>
<structure>
<property name="name">salesbydate.dsOrders.y</property>
<property name="type">integer</property>
<property name="isVisible">false</property>
</structure>
<structure>
<property
name="name">salesbydate.ProductGroup.NewTabularHierarchy.x</property>
<property name="type">integer</property>
<property name="isVisible">false</property>
</structure>
<structure>
<property
name="name">salesbydate.ProductGroup.NewTabularHierarchy.y</property>
<property name="type">integer</property>
<property name="isVisible">false</property>
</structure>
<structure>
<property name="name">salesbydate.dsOrders.width</property>
<property name="type">integer</property>
<property name="isVisible">false</property>
</structure>
<structure>
<property name="name">salesbydate.dsOrders.height</property>
<property name="type">integer</property>
<property name="isVisible">false</property>
</structure>
</list-property>
<property name="salesbydate.dsOrders.x">251</property>
<property name="salesbydate.dsOrders.y">47</property>
<property
name="salesbydate.ProductGroup.NewTabularHierarchy.x">39</property>
<property
name="salesbydate.ProductGroup.NewTabularHierarchy.y">69</property>
<property name="salesbydate.dsOrders.width">150</property>
<property name="salesbydate.dsOrders.height">200</property>
<property name="units">in</property>
<method
name="beforeFactory"><![CDATA[reportContext.getDesignHandle().findElement("quarter").drop();]]></method>
<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="customers" id="8">
<list-property name="columnHints">
<structure>
<property name="columnName">CUSTOMERNUMBER</property>
<text-property
name="displayName">CUSTOMERNUMBER</text-property>
</structure>
<structure>
<property name="columnName">CUSTOMERNAME</property>
<text-property
name="displayName">CUSTOMERNAME</text-property>
</structure>
<structure>
<property name="columnName">CONTACTLASTNAME</property>
<text-property
name="displayName">CONTACTLASTNAME</text-property>
</structure>
<structure>
<property name="columnName">CONTACTFIRSTNAME</property>
<text-property
name="displayName">CONTACTFIRSTNAME</text-property>
</structure>
<structure>
<property name="columnName">PHONE</property>
<text-property name="displayName">PHONE</text-property>
</structure>
<structure>
<property name="columnName">ADDRESSLINE1</property>
<text-property
name="displayName">ADDRESSLINE1</text-property>
</structure>
<structure>
<property name="columnName">ADDRESSLINE2</property>
<text-property
name="displayName">ADDRESSLINE2</text-property>
</structure>
<structure>
<property name="columnName">CITY</property>
<text-property name="displayName">CITY</text-property>
</structure>
<structure>
<property name="columnName">STATE</property>
<text-property name="displayName">STATE</text-property>
</structure>
<structure>
<property name="columnName">POSTALCODE</property>
<text-property
name="displayName">POSTALCODE</text-property>
</structure>
<structure>
<property name="columnName">COUNTRY</property>
<text-property
name="displayName">COUNTRY</text-property>
</structure>
<structure>
<property
name="columnName">SALESREPEMPLOYEENUMBER</property>
<text-property
name="displayName">SALESREPEMPLOYEENUMBER</text-property>
</structure>
<structure>
<property name="columnName">CREDITLIMIT</property>
<text-property
name="displayName">CREDITLIMIT</text-property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CUSTOMERNAME</property>
<property name="dataType">string</property>
</structure>
<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>
<xml-property name="queryText"><![CDATA[select *
from customers]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CUSTOMERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CUSTOMERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNAME</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CUSTOMERNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CUSTOMERNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTLASTNAME</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTACTLASTNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTACTLASTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTFIRSTNAME</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTACTFIRSTNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTACTFIRSTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PHONE</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PHONE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PHONE</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ADDRESSLINE1</design:name>
<design:position>6</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ADDRESSLINE1</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ADDRESSLINE1</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ADDRESSLINE2</design:name>
<design:position>7</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ADDRESSLINE2</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ADDRESSLINE2</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CITY</design:name>
<design:position>8</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CITY</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CITY</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>STATE</design:name>
<design:position>9</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>STATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>STATE</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>POSTALCODE</design:name>
<design:position>10</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>POSTALCODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>POSTALCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>COUNTRY</design:name>
<design:position>11</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>COUNTRY</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>COUNTRY</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>SALESREPEMPLOYEENUMBER</design:name>
<design:position>12</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>SALESREPEMPLOYEENUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>SALESREPEMPLOYEENUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CREDITLIMIT</design:name>
<design:position>13</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CREDITLIMIT</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CREDITLIMIT</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet"
name="dsOrders" id="9">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
</structure>
<structure>
<property name="columnName">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
</structure>
<structure>
<property name="columnName">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
</structure>
<structure>
<property name="columnName">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
</structure>
<structure>
<property name="columnName">ORDERNUMBER_6</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
</structure>
<structure>
<property name="columnName">ORDERDATE</property>
<text-property
name="displayName">ORDERDATE</text-property>
</structure>
<structure>
<property name="columnName">REQUIREDDATE</property>
<text-property
name="displayName">REQUIREDDATE</text-property>
</structure>
<structure>
<property name="columnName">SHIPPEDDATE</property>
<text-property
name="displayName">SHIPPEDDATE</text-property>
</structure>
<structure>
<property name="columnName">STATUS</property>
<text-property
name="displayName">STATUS</text-property>
</structure>
<structure>
<property name="columnName">COMMENTS</property>
<text-property
name="displayName">COMMENTS</text-property>
</structure>
<structure>
<property name="columnName">CUSTOMERNUMBER</property>
<text-property
name="displayName">CUSTOMERNUMBER</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>
<structure>
<property name="position">6</property>
<property name="name">ORDERNUMBER_6</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">7</property>
<property name="name">ORDERDATE</property>
<property name="dataType">date</property>
</structure>
<structure>
<property name="position">8</property>
<property name="name">REQUIREDDATE</property>
<property name="dataType">date</property>
</structure>
<structure>
<property name="position">9</property>
<property name="name">SHIPPEDDATE</property>
<property name="dataType">date</property>
</structure>
<structure>
<property name="position">10</property>
<property name="name">STATUS</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">11</property>
<property name="name">COMMENTS</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">12</property>
<property name="name">CUSTOMERNUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">5</property>
</structure>
<structure>
<property name="position">6</property>
<property name="name">ORDERNUMBER_6</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">7</property>
<property name="name">ORDERDATE</property>
<property name="nativeName">ORDERDATE</property>
<property name="dataType">date</property>
<property name="nativeDataType">91</property>
</structure>
<structure>
<property name="position">8</property>
<property name="name">REQUIREDDATE</property>
<property name="nativeName">REQUIREDDATE</property>
<property name="dataType">date</property>
<property name="nativeDataType">91</property>
</structure>
<structure>
<property name="position">9</property>
<property name="name">SHIPPEDDATE</property>
<property name="nativeName">SHIPPEDDATE</property>
<property name="dataType">date</property>
<property name="nativeDataType">91</property>
</structure>
<structure>
<property name="position">10</property>
<property name="name">STATUS</property>
<property name="nativeName">STATUS</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">11</property>
<property name="name">COMMENTS</property>
<property name="nativeName">COMMENTS</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">12</property>
<property name="name">CUSTOMERNUMBER</property>
<property name="nativeName">CUSTOMERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select *
from CLASSICMODELS.ORDERDETAILS, CLASSICMODELS.ORDERS
where CLASSICMODELS.ORDERS.ORDERNUMBER =
CLASSICMODELS.ORDERDETAILS.ORDERNUMBER
and
CLASSICMODELS.ORDERS.STATUS = 'Shipped']]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRODUCTCODE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRODUCTCODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRODUCTCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>QUANTITYORDERED</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>QUANTITYORDERED</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>QUANTITYORDERED</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRICEEACH</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRICEEACH</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRICEEACH</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERLINENUMBER</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>5</design:nativeDataTypeCode>
<design:precision>5</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERLINENUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERLINENUMBER</design:label>
<design:formattingHints>
<design:displaySize>6</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>6</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERDATE</design:name>
<design:position>7</design:position>
<design:nativeDataTypeCode>91</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERDATE</design:label>
<design:formattingHints>
<design:displaySize>10</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>REQUIREDDATE</design:name>
<design:position>8</design:position>
<design:nativeDataTypeCode>91</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>REQUIREDDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>REQUIREDDATE</design:label>
<design:formattingHints>
<design:displaySize>10</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>SHIPPEDDATE</design:name>
<design:position>9</design:position>
<design:nativeDataTypeCode>91</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>SHIPPEDDATE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>SHIPPEDDATE</design:label>
<design:formattingHints>
<design:displaySize>10</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name&g
|
|
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #685673 is a reply to message #685435] |
Sat, 18 June 2011 03:58 |
brush Messages: 7 Registered: June 2011 |
Junior Member |
|
|
and jason,
i'd love to try your solution too, but unfortunately the file you pasted into the message was cut short, and can't be opened. can you attach the file? or describe/copy just the script itself?
UPDATE:
i think this may be the report you're referring to, on the birt-exchange: um, i haven't posted 5 msgs, so google for birt-creating-your-own-running-sum-in-a-crosstab on the birt-exchange, and see attached.
however, i have two just one follow-up question.
1) when i created a :Text: object with the same cell content in the detail of the crosstab as the one in the demo file, it didn't run but rather simply printed the text (rather as i would expect). when i copied the entire cell, it executed (with errors). what is being set so that the code in the text is executed?
2) i slightly edited the content of the file to the following. it outputs null. any ideas why?
UPDATE
ok, figured it out. in a data cube, you need to refer to rows by their measure["xx"] or dimension["firstlevel"]["secondlevel"] etc. names. works now! thanks! still curious about the above...
<VALUE-OF>if (reportContext.getPersistentGlobalVariable("runningbalance") == null){
if (row["amount"] == null){
temp = 0;
}
else{
temp = row["amount"];
reportContext.setPersistentGlobalVariable("runningbalance", temp.toString());
}
}
else{
temp = parseInt(reportContext.getPersistentGlobalVariable("runningbalance")) + row["amount"]
reportContext.setPersistentGlobalVariable("runningbalance", temp.toString());
}
temp;</VALUE-OF>
thanks a ton!
.b
[Updated on: Sat, 18 June 2011 05:52] Report message to a moderator
|
|
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #686238 is a reply to message #686082] |
Tue, 21 June 2011 21:43 |
brush Messages: 7 Registered: June 2011 |
Junior Member |
|
|
thanks, jason, for the suggestions on how to do similar thing in script.
i actually figured out the specific answer to my question above: if a text field has content type "HTML" then <value-of> script will get executed, near as i can tell.
(i also upgraded postgresql to 8.4 and tried the windowing functions, which are clearly powerful but resulted in some peculiar behavior when trying to group resulting data ... more perhaps in another post.)
so i've been working with the <value-of> text box, which results in printable crosstab with accurate data (oh, one comment: i found the script as written was often dropping the final iteration of the sum, so i output the actual global variable rather than temp, and it seems to work correctly).
however, i've been having major headaches trying to display this data as a chart. what is the best way (*is* there a way) to access scripted data content from a crosstab or table in a chart?
i ended up creating non-crosstab tables with the data presented vertically, which would then be hidden, in order to essentially redo the whole thing in the chart using runningsum over the groups. however, i've had significant challenges with getting the data to present accurately what's in the tables when there are multiple series groupings and the only data i want to chart is the aggregate-over-group runningsum, not the detail. ... more on this separately, perhaps.
but that's a specific question: how can we best access javascripted data in a chart?
thanks!
.b
|
|
| | |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #687609 is a reply to message #687606] |
Wed, 22 June 2011 20:36 |
brush Messages: 7 Registered: June 2011 |
Junior Member |
|
|
by the way, for those interested in the windowing sql approach, here's the challenge i'm currently stuck on: i finally got the SQL to calculate balances correctly, but it only produces a value in any given quarter if there's at least one transaction in that quarter. this is a problem: with a "running balance" any activity in a previous period should result in a value being printed, even if unchanged from the previous quarter.
i was looking at trying to come up with a subselect that would let me do an outer join that would force an entry for every quarter-account combo, but haven't quite figured it out. ideas?
here's the sql i'm currently working with (for ledger-smb data structure):
select c.accno, date_trunc('quarter', ac.transdate) as quarter,
sum(ac.amount) as qtot,
sum(sum(ac.amount)) over (partition by accno order by date_trunc('quarter', ac.transdate)) as balance
from chart c
left join acc_trans ac on (c.id = ac.chart_id)
group by c.accno, date_trunc('quarter', ac.transdate);
the left (outer) join forces there to be one entry for every account in the chart -- but i need one entry per account PER QUARTER. ideas?
[Updated on: Wed, 22 June 2011 20:38] Report message to a moderator
|
|
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #687756 is a reply to message #687609] |
Thu, 23 June 2011 06:53 |
Tomas Greif Messages: 53 Registered: September 2010 |
Member |
|
|
Hi,
try the following sql:
with
-- GENERATE SOME RANDOM DATA --
chart as (
select 1 id, 12345 accno union all
select 2 id, 23456 accno union all
select 3 id, 34567 accno)
,
acc_trans as (
select '2010-01-01'::date transdate, 100.0 amount, 1 chart_id union all
select '2010-04-01'::date transdate, 100.0 amount, 1 chart_id union all
select '2010-10-01'::date transdate, 100.0 amount, 1 chart_id union all
select '2010-10-01'::date transdate, 100.0 amount, 2 chart_id union all
select '2010-01-01'::date transdate, 100.0 amount, 2 chart_id union all
select '2010-10-01'::date transdate, 100.0 amount, 3 chart_id)
-- CALCULATE OUTPUT
-- 1) aggregate transactions
,
trans_aggregation as (
select
c.accno,
c.id,
date_trunc('quarter', ac.transdate) as granularity,
sum(ac.amount) as qtot
from
chart c
left join acc_trans ac on (c.id = ac.chart_id)
group by
c.accno,
date_trunc('quarter', ac.transdate),
c.id
)
-- 2) calculate running sum
select
d.granularity,
d.id,
coalesce(sum(qtot) over (partition by d.id order by granularity rows between unbounded preceding and current row),0.0) as qtot
from
(select
*
from
(SELECT generate_series('2010-01-01'::date::timestamp with time zone, Now()::date::timestamp with time zone, '3 months '::interval)::date AS granularity) a , -- generate quarters
(select id from chart) b -- and create product with account id
) d
left join trans_aggregation using (granularity, id)
Tomas
|
|
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #709644 is a reply to message #685673] |
Thu, 04 August 2011 06:06 |
jeyinul Messages: 60 Registered: June 2011 |
Member |
|
|
HI Jason,
<VALUE-OF>if (reportContext.getPersistentGlobalVariable("runningbalance") == null){
if (row["amount"] == null){
temp = 0;
}
else{
temp = row["amount"];
reportContext.setPersistentGlobalVariable("runningbalance", temp.toString());
}
}
else{
temp = parseInt(reportContext.getPersistentGlobalVariable("runningbalance")) + row["amount"]
reportContext.setPersistentGlobalVariable("runningbalance", temp.toString());
}
temp;</VALUE-OF>
This code is working for running sum.
I am getting both row and column wise running sum,
I want row wise running sum.
My cross tab is like,
Project Name || Revenue || Jan || Feb || Mar || Apr
A ||||||||||| J1 ||||||| 0 || 1 || 3 || 0
A ||||||||||| J2 ||||||| 10 || 11 || 3 || 0
B ||||||||||| J1 ||||||| 0 || 1 || 3 || 0
B ||||||||||| J2 ||||||| 10 || 11 || 3 || 0
From the above table, The revenue will be changing always,
From the script, the output is NOT correct for 2 revenues
I want the output like, running sum
A ||||||||||| J1 ||||||| 0 || 1 || 4 || 4
A ||||||||||| J2 ||||||| 10 || 21 || 24 || 24
B ||||||||||| J1 ||||||| 0 || 1 || 4 || 4
B ||||||||||| J2 ||||||| 10 || 21 || 24 || 24
Can you please help me on this.
Thanks,
Jeyinul.
[Updated on: Thu, 04 August 2011 12:02] Report message to a moderator
|
|
|
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #709997 is a reply to message #709644] |
Thu, 04 August 2011 15:06 |
|
I am not certain what you mean by the script is correct for 2 revenues.
If you use a script similar to the one I posted previously you can reset
it on the Revenue label field oncreate. For example in you xtab reset
it on the onCreate script for the label that produces J1, J2.
Jason
On 8/4/2011 2:06 AM, jeyinul wrote:
> HI Jason,
>
> <VALUE-OF>if
> (reportContext.getPersistentGlobalVariable("runningbalance") == null){
> if (row["amount"] == null){
> temp = 0;
> }
> else{
> temp = row["amount"];
> reportContext.setPersistentGlobalVariable("runningbalance",
> temp.toString());
> }
> }
> else{
> temp =
> parseInt(reportContext.getPersistentGlobalVariable("runningbalance")) +
> row["amount"]
> reportContext.setPersistentGlobalVariable("runningbalance",
> temp.toString());
> }
> temp;</VALUE-OF>
>
>
> This code is working for running sum.
>
> I have one doubt,
>
> My cross tab is like,
>
> Project Name || Revenue || Jan || Feb || Mar || Apr
> A ||||||||||| J1 ||||||| 0 || 1 || 3 || 0
> A ||||||||||| J2 ||||||| 10 || 11 || 3 || 0
>
> B ||||||||||| J1 ||||||| 0 || 1 || 3 || 0
> B ||||||||||| J2 ||||||| 10 || 11 || 3 || 0
>
> From the above table, The revenue will be changing always,
>
> From the script, the output is correct for 2 revenues
>
> I want the output like, running sum
>
> A ||||||||||| J1 ||||||| 0 || 1 || 4 || 4
> A ||||||||||| J2 ||||||| 10 || 21 || 24 || 24
>
> B ||||||||||| J1 ||||||| 0 || 1 || 3 || 0
> B ||||||||||| J2 ||||||| 10 || 21 || 24 || 24
>
>
> Can you please help me on this.
>
> Thanks,
> Jeyinul.
>
>
|
|
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #713660 is a reply to message #710648] |
Mon, 08 August 2011 18:34 |
|
Try putting a script on the label that produces J1 and J2. Use onCreate
and set
var temp=0;
reportContext.setPersistentGlobalVariable("runningbalance",
temp.toString());
Jason
On 8/5/2011 4:59 AM, jeyinul wrote:
> How to reset.
>
> Please help me on this.
>
> I will explain abt my report.
>
> This is a cross tab. In row, we have Projectname and in column, we have
> Month and In summary we have the valus of Revenue.
>
> The script is working for the above one. Now if i add one more
> column(this column already added in summary field of data cube),
> I am getting the wrong count.Its taking the value of last i.e December
> value.
>
> Plz help me.
>
> Regards,
> Jeyinul.
|
|
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #713999 is a reply to message #713843] |
Tue, 09 August 2011 14:45 |
|
Look at the attached example. The fields in yellow and red show a
running sum that is reset for every group. Look at the script on the
PRODUCTLINE dimension and the script on the QUANTITYORDERED field. In
the example the QUANTITYORDERED field is hidden but it still executes.
Every the product line changes this script executes:
//did not really need to check for undefined here
if( typeof mysum != 'undefined'){
mysum =0;
}else{
mysum = 0;
}
This just resets the counter. Every time the QUANTITYORDERED field is
created this script runs.
if( typeof mysum != 'undefined'){
mysum = parseInt(this.getValue()) + mysum;
}else{
mysum = parseInt(this.getValue());
}
Which increments the sum. I then use the value-of in a text element to
display it.
<VALUE-OF>mysum</VALUE-OF>
Jason
On 8/9/2011 3:21 AM, jeyinul wrote:
> Thanks Jason,
>
> Everything is fine.
>
> Now i have added one more group in the row.
> Please find the attachment for your reference.
>
> Now please send me script for calculating Running sum.
>
> The below code i am using for single group in row,
>
> <VALUE-OF>if (reportContext.getPersistentGlobalVariable(data["PRODUCTLINE"]) == null){
> if (data["QUANTITYINSTOCK_Group/PRODUCTLINE_Group1/PRODUCTSCALE"] == null){
> temp = 0;
> }
> else{
> temp = data["QUANTITYINSTOCK_Group/PRODUCTLINE_Group1/PRODUCTSCALE"];
> reportContext.setPersistentGlobalVariable(data["PRODUCTLINE"], temp.toString());
> }
> }
> else{
> temp = parseInt(reportContext.getPersistentGlobalVariable(data["PRODUCTLINE"])) + data["QUANTITYINSTOCK_Group/PRODUCTLINE_Group1/PRODUCTSCALE"]
> reportContext.setPersistentGlobalVariable(data["PRODUCTLINE"], temp.toString());
> }
> temp;</VALUE-OF>
>
>
> Please help me on this.
>
> Regards,
> Jeyinul.
|
|
|
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #714722 is a reply to message #713999] |
Thu, 11 August 2011 11:31 |
jeyinul Messages: 60 Registered: June 2011 |
Member |
|
|
Thanks Jason,
Its working fine. But one doubt in display values. Some values comes like 1.2340000.
It comes from the script. I have given ParseFloat. If i change into ParseInt then BIRT IS NOT TAKING THE VALUE AFTER ".".
I want like 1.234.
In my report, There are two inputs which are not mandatory. I will give any one input at a time.
BIRT doesn't prompt the input parameters while running. If input is mandatory then it displays.
But I don't want like that.
Plz help me on this
Regards,
Jeyinul.
[Updated on: Thu, 11 August 2011 11:36] Report message to a moderator
|
|
|
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #714871 is a reply to message #714722] |
Thu, 11 August 2011 15:15 |
|
Use a format class to format the value:
importPackage(Packages.java.text);
importPackage(Packages.java.util);
var formatter = new DecimalFormat("#0.00");
this.setDisplayValue(formatter.format(d));
Where d is the value that you have summed.
To always display the parameter page add:
&__parameterpage=true to the frameset url
Jason
On 8/11/2011 7:31 AM, jeyinul wrote:
> Thanks Jason,
>
> Its working fine. But one doubt in display values. Some values comes
> like 1.2340000.
> I want like 1.234.
>
> In my report, There are two inputs which are not mandatory. I will give
> any one input at a time.
> BIRT doesn't prompt the input parameters while running. If input is
> mandatory then it displays.
>
> But I don't want like that.
>
> Plz help me on this
>
> Regards,
> Jeyinul.
>
|
|
| |
Re: Balance sheet dynamic crosstab: how to sum up to date rather than between dates [message #715186 is a reply to message #715023] |
Fri, 12 August 2011 15:39 |
|
You can use the script in the onCreate of the element that displays the
value. But after thinking about this I think it is better to just
select the data item and use the Format Number tab in the properties
editor to format it like you want. If you are using a text element use
and expression something like:
<VALUE-OF format="$#,##0.00">mysum;</VALUE-OF>
Jason
On 8/12/2011 2:24 AM, jeyinul wrote:
> Hi Jason,
>
> Where i have to add the script.Please give some more explanation.
> I don't know the java script. So, Plz send full code where i have to use.
>
> One more doubt in running some. If values are 0 then it displays like
> "NaN".
> Plz help me on this also.
>
>
> Regards,
> Jeyinul.
>
|
|
| | | | |
Goto Forum:
Current Time: Thu Sep 19 02:18:36 GMT 2024
Powered by FUDForum. Page generated in 0.07909 seconds
|