Home > BaaN, BIRT, Infor > Report in Matrix format – BIRT Example 2

Report in Matrix format – BIRT Example 2


Now that we have done through reports with dynamic columns in Example 1 in my previous post, now what about printing the report in matrix format.

This is quite simple, All you need to do is insert a crosstab in a grid without having any sort of grouping.

Below is the rptdesign XML source for further reference

<?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 &lt;2.2.0.v20070924-1550></property>
    <property name="units">in</property>
    <property name="comments">Copyright (c) 2007 &lt;&lt;Your Company Name here>></property>
    <html-property name="description">Creates a blank report with no predefined content.</html-property>
    <text-property name="displayName">Blank Report</text-property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <data-sources>
        <oda-data-source extensionID="org.eclipse.datatools.connectivity.oda.flatfile" name="Data Source" id="6">
            <property name="HOME">C:\Documents and Settings\90385833\Desktop\embeddedCrosstab</property>
            <property name="DELIMTYPE">COMMA</property>
            <property name="CHARSET">UTF-8</property>
            <property name="INCLCOLUMNNAME">YES</property>
            <property name="INCLTYPELINE">NO</property>
        </oda-data-source>
    </data-sources>
    <data-sets>
        <oda-data-set extensionID="org.eclipse.datatools.connectivity.oda.flatfile.dataSet" name="Data Set" id="7">
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">Ledger</property>
                        <property name="dataType">integer</property>
                    </structure>
                    <structure>
                        <property name="position">2</property>
                        <property name="name">Debit</property>
                        <property name="dataType">float</property>
                    </structure>
                    <structure>
                        <property name="position">3</property>
                        <property name="name">Credit</property>
                        <property name="dataType">float</property>
                    </structure>
                    <structure>
                        <property name="position">4</property>
                        <property name="name">Project</property>
                        <property name="dataType">string</property>
                    </structure>
                    <structure>
                        <property name="position">5</property>
                        <property name="name">Balance</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">Ledger</property>
                    <property name="nativeName">Ledger</property>
                    <property name="dataType">integer</property>
                    <property name="nativeDataType">4</property>
                </structure>
                <structure>
                    <property name="position">2</property>
                    <property name="name">Debit</property>
                    <property name="nativeName">Debit</property>
                    <property name="dataType">float</property>
                    <property name="nativeDataType">8</property>
                </structure>
                <structure>
                    <property name="position">3</property>
                    <property name="name">Credit</property>
                    <property name="nativeName">Credit</property>
                    <property name="dataType">float</property>
                    <property name="nativeDataType">8</property>
                </structure>
                <structure>
                    <property name="position">4</property>
                    <property name="name">Project</property>
                    <property name="nativeName">Project</property>
                    <property name="dataType">string</property>
                    <property name="nativeDataType">12</property>
                </structure>
                <structure>
                    <property name="position">5</property>
                    <property name="name">Balance</property>
                    <property name="nativeName">Balance</property>
                    <property name="dataType">float</property>
                    <property name="nativeDataType">8</property>
                </structure>
            </list-property>
            <property name="queryText">select "Ledger", "Debit", "Credit", "Project", 
"Balance" from embeddedCrosstab.csv : {"Ledger","Ledger",INT;"Debit","Debit",DOUBLE;"Credit","Credit",DOUBLE;"
Project","Project",STRING;"Balance","Balance",DOUBLE}</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>Ledger</design:name>
            <design:position>1</design:position>
            <design:nativeDataTypeCode>4</design:nativeDataTypeCode>
            <design:precision>-1</design:precision>
            <design:scale>-1</design:scale>
            <design:nullability>Unknown</design:nullability>
          </design:attributes>
          <design:usageHints>
            <design:label>Ledger</design:label>
            <design:formattingHints/>
          </design:usageHints>
        </design:resultColumnDefinitions>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:name>Debit</design:name>
            <design:position>2</design:position>
            <design:nativeDataTypeCode>8</design:nativeDataTypeCode>
            <design:precision>-1</design:precision>
            <design:scale>-1</design:scale>
            <design:nullability>Unknown</design:nullability>
          </design:attributes>
          <design:usageHints>
            <design:label>Debit</design:label>
            <design:formattingHints/>
          </design:usageHints>
        </design:resultColumnDefinitions>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:name>Credit</design:name>
            <design:position>3</design:position>
            <design:nativeDataTypeCode>8</design:nativeDataTypeCode>
            <design:precision>-1</design:precision>
            <design:scale>-1</design:scale>
            <design:nullability>Unknown</design:nullability>
          </design:attributes>
          <design:usageHints>
            <design:label>Credit</design:label>
            <design:formattingHints/>
          </design:usageHints>
        </design:resultColumnDefinitions>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:name>Project</design:name>
            <design:position>4</design:position>
            <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
            <design:precision>-1</design:precision>
            <design:scale>-1</design:scale>
            <design:nullability>Unknown</design:nullability>
          </design:attributes>
          <design:usageHints>
            <design:label>Project</design:label>
            <design:formattingHints/>
          </design:usageHints>
        </design:resultColumnDefinitions>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:name>Balance</design:name>
            <design:position>5</design:position>
            <design:nativeDataTypeCode>8</design:nativeDataTypeCode>
            <design:precision>-1</design:precision>
            <design:scale>-1</design:scale>
            <design:nullability>Unknown</design:nullability>
          </design:attributes>
          <design:usageHints>
            <design:label>Balance</design:label>
            <design:formattingHints/>
          </design:usageHints>
        </design:resultColumnDefinitions>
      </design:resultSetColumns>
    </design:resultSetDefinitions>
  </design:ResultSets>
</model:DesignValues>]]></xml-property>
        </oda-data-set>
    </data-sets>
    <cubes>
        <tabular-cube name="Data Cube" id="24">
            <property name="defaultMeasureGroup">Summary Field</property>
            <property name="dimensions">
                <tabular-dimension name="Group" id="28">
                    <property name="defaultHierarchy">NewTabularHierarchy</property>
                    <property name="hierarchies">
                        <tabular-hierarchy name="NewTabularHierarchy" id="29">
                            <property name="levels">
                                <tabular-level name="Project" id="30">
                                    <property name="dataType">string</property>
                                    <property name="columnName">Project</property>
                                </tabular-level>
                            </property>
                        </tabular-hierarchy>
                    </property>
                </tabular-dimension>
                <tabular-dimension name="Group1" id="31">
                    <property name="defaultHierarchy">NewTabularHierarchy1</property>
                    <property name="hierarchies">
                        <tabular-hierarchy name="NewTabularHierarchy1" id="32">
                            <property name="levels">
                                <tabular-level name="Ledger" id="33">
                                    <property name="dataType">integer</property>
                                    <property name="columnName">Ledger</property>
                                </tabular-level>
                            </property>
                        </tabular-hierarchy>
                    </property>
                </tabular-dimension>
            </property>
            <property name="measureGroups">
                <tabular-measure-group name="Summary Field" id="25">
                    <property name="measures">
                        <tabular-measure name="Debit" id="26">
                            <expression name="measureExpression">dataSetRow["Debit"]</expression>
                            <property name="dataType">float</property>
                        </tabular-measure>
                        <tabular-measure name="Credit" id="27">
                            <expression name="measureExpression">dataSetRow["Credit"]</expression>
                            <property name="dataType">float</property>
                        </tabular-measure>
                        <tabular-measure name="Balance" id="159">
                            <expression name="measureExpression">dataSetRow["Balance"]</expression>
                            <property name="dataType">float</property>
                        </tabular-measure>
                    </property>
                </tabular-measure-group>
            </property>
            <property name="dataSet">Data Set</property>
        </tabular-cube>
    </cubes>
    <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>
    </styles>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2">
            <page-footer>
                <text id="3">
                    <property name="contentType">html</property>
                    <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
                </text>
            </page-footer>
        </simple-master-page>
    </page-setup>
    <body>
        <table id="8">
            <property name="width">100%</property>
            <property name="dataSet">Data Set</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">Ledger</property>
                    <expression name="expression">dataSetRow["Ledger"]</expression>
                    <property name="dataType">integer</property>
                </structure>
                <structure>
                    <property name="name">Debit</property>
                    <expression name="expression">dataSetRow["Debit"]</expression>
                    <property name="dataType">float</property>
                </structure>
                <structure>
                    <property name="name">Credit</property>
                    <expression name="expression">dataSetRow["Credit"]</expression>
                    <property name="dataType">float</property>
                </structure>
                <structure>
                    <property name="name">Project</property>
                    <expression name="expression">dataSetRow["Project"]</expression>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="name">Balance</property>
                    <expression name="expression">dataSetRow["Balance"]</expression>
                    <property name="dataType">float</property>
                </structure>
            </list-property>
            <column id="15"/>
            <header>
                <row id="9">
                    <cell id="10">
                        <label id="16">
                            <text-property name="text">Ledger</text-property>
                        </label>
                    </cell>
                </row>
            </header>
            <footer>
                <row id="13">
                    <cell id="14">
                        <extended-item extensionName="Crosstab" id="160">
                            <property name="measures">
                                <extended-item extensionName="MeasureView" id="171">
                                    <property name="measure">Balance</property>
                                    <property name="detail">
                                        <extended-item extensionName="CrosstabCell" id="172">
                                            <property name="content">
                                                <data name="Balance" id="174">
                                                    <property name="resultSetColumn">Balance</property>
                                                </data>
                                            </property>
                                        </extended-item>
                                    </property>
                                    <property name="header">
                                        <extended-item extensionName="CrosstabCell" id="173">
                                            <property name="content">
                                                <label id="175">
                                                    <text-property name="text">Balance</text-property>
                                                </label>
                                            </property>
                                        </extended-item>
                                    </property>
                                </extended-item>
                            </property>
                            <property name="rows">
                                <extended-item extensionName="CrosstabView" id="166">
                                    <property name="views">
                                        <extended-item extensionName="DimensionView" id="167">
                                            <property name="dimension">Group1</property>
                                            <property name="levels">
                                                <extended-item extensionName="LevelView" name="NewLevel View1" id="168">
                                                    <property name="level">Group1/Ledger</property>
                                                    <property name="member">
                                                        <extended-item extensionName="CrosstabCell" id="169">
                                                            <property name="content">
                                                                <data name="Ledger" id="170">
                                                                    <property name="resultSetColumn">Ledger</property>
                                                                </data>
                                                            </property>
                                                        </extended-item>
                                                    </property>
                                                </extended-item>
                                            </property>
                                        </extended-item>
                                    </property>
                                </extended-item>
                            </property>
                            <property name="columns">
                                <extended-item extensionName="CrosstabView" id="161">
                                    <property name="views">
                                        <extended-item extensionName="DimensionView" id="162">
                                            <property name="dimension">Group</property>
                                            <property name="levels">
                                                <extended-item extensionName="LevelView" name="NewLevel View" id="163">
                                                    <property name="level">Group/Project</property>
                                                    <property name="member">
                                                        <extended-item extensionName="CrosstabCell" id="164">
                                                            <property name="content">
                                                                <data name="Project" id="165">
                                                                    <property name="resultSetColumn">Project_1</property>
                                                                </data>
                                                            </property>
                                                        </extended-item>
                                                    </property>
                                                </extended-item>
                                            </property>
                                        </extended-item>
                                    </property>
                                </extended-item>
                            </property>
                            <property name="cube">Data Cube</property>
                            <list-property name="boundDataColumns">
                                <structure>
                                    <property name="name">Project_1</property>
                                    <expression name="expression">dimension["Group"]["Project"]</expression>
                                    <property name="dataType">string</property>
                                </structure>
                                <structure>
                                    <property name="name">Ledger</property>
                                    <expression name="expression">dimension["Group1"]["Ledger"]</expression>
                                    <property name="dataType">integer</property>
                                </structure>
                                <structure>
                                    <property name="name">Balance</property>
                                    <expression name="expression">measure["Balance"]</expression>
                                    <property name="dataType">float</property>
                                </structure>
                            </list-property>
                        </extended-item>
                    </cell>
                </row>
            </footer>
        </table>
    </body>
</report>

Report Output is attached below.

Advertisements
Categories: BaaN, BIRT, Infor Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: