Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Example of BIRT and Avery 5160 mailing labels(I am posting a simple mailing label report hoping it might be useful to others and/or stimulate discussion)
Example of BIRT and Avery 5160 mailing labels [message #1221479] Tue, 17 December 2013 15:00
Larry Talley is currently offline Larry Talley
Messages: 7
Registered: December 2013
Junior Member
There are probably better ways of doing mailing labels, but I wanted a simple base where I understood the way dimensions were specified and why they were specified that way, so I took other's work and reduced and tuned it to get my example below.

I think the import aspects of this example are:

The master page expressed the dimensions of the Avery 5160 3-up label page, while the grid element expresses the dimensions of one Avery 5160 label (less margins), and the rows in the grid express the potential lines of text on the label.

Padding is set to zero explicitly everywhere so that dimensions are actual measurements. Margins in the grid give some white space around the text on the label, margins in the master page express the waste space on the label page.

Note that this example may not work if your printer isn't configured for "bleed" or "edge-to-edge" or "margins none" printing. See http://www.eclipse.org/forums/index.php/mv/msg/628325/1220619/#msg_1220619 for more detail.

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 4.3.1.v201309091055 Build &lt;4.3.1.v20130917-1035></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<list-property name="libraries">
<structure>
<property name="fileName">Libraries/DatabaseConnection.rptlibrary</property>
<property name="namespace">DatabaseConnection</property>
</structure>
<structure>
<property name="fileName">Libraries/Fees.rptlibrary</property>
<property name="namespace">Fees</property>
</structure>
<structure>
<property name="fileName">Libraries/displayCurrentDate.rptlibrary</property>
<property name="namespace">displayCurrentDate</property>
</structure>
</list-property>
<parameters>
<scalar-parameter name="pYear" id="389">
<text-property name="promptText">Fishing year:</text-property>
<property name="valueType">static</property>
<property name="dataType">integer</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="javascript">BirtDateTime.year(new Date())</value>
</simple-property-list>
<list-property name="selectionList"/>
<property name="paramType">simple</property>
<property name="controlType">text-box</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
<scalar-parameter name="pPersonId" id="391">
<text-property name="promptText">NMFS ID:</text-property>
<property name="valueType">dynamic</property>
<property name="dataSetName">PersonList</property>
<expression name="valueExpr" type="javascript">dataSetRow["ID"]</expression>
<expression name="labelExpr" type="javascript">dataSetRow["ID"]</expression>
<property name="dataType">string</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="constant">%</value>
</simple-property-list>
<list-property name="selectionList"/>
<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="pManagementProgramId" id="753">
<property name="hidden">true</property>
<property name="valueType">static</property>
<property name="dataType">integer</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="constant">12</value>
</simple-property-list>
<list-property name="selectionList"/>
<property name="paramType">simple</property>
<property name="controlType">text-box</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
<parameter-group name="DataSourceParamGroup" id="757" extends="DatabaseConnection.DataSourceParamGroup">
<overridden-values>
<ref-entry baseId="385" name="pUserName" id="385"/>
<ref-entry baseId="386" name="pPassword" id="386"/>
<ref-entry baseId="387" name="pDatabaseInstance" id="387"/>
</overridden-values>
</parameter-group>
</parameters>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="AKR DS with Parameters" id="756"
extends="DatabaseConnection.AKR DS with Parameters"/>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="PersonList" id="390">
<list-property name="parameters">
<structure>
<property name="name">pMpId</property>
<property name="paramName">pManagementProgramId</property>
<property name="dataType">integer</property>
<property name="position">1</property>
<expression name="defaultValue" type="javascript">vars["ManagementProgramId"]</expression>
<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">ID</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">NAME</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">AKR DS with Parameters</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ID</property>
<property name="nativeName">ID</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">NAME</property>
<property name="nativeName">NAME</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select '%' id,'ALL' name from dual
union
select to_char(a.person_id) id, b.name
from mgmtprog_fee_person_year a
join nmfs_id_name b on a.person_id = b.person_id
where a.management_program_id = ?

]]></xml-property>
</oda-data-set>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="Addresses" id="752">
<list-property name="parameters">
<structure>
<property name="name">pYear</property>
<property name="paramName">pYear</property>
<property name="dataType">integer</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
<structure>
<property name="name">pMpId</property>
<property name="paramName">pManagementProgramId</property>
<property name="dataType">integer</property>
<property name="position">2</property>
<expression name="defaultValue" type="javascript">vars["ManagementProgramId"]</expression>
<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">PERSON_NAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">ADDRESS2</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">ADDRESS3</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">ADDRESS4</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">AKR DS with Parameters</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">PERSON_NAME</property>
<property name="nativeName">PERSON_NAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">ADDRESS2</property>
<property name="nativeName">ADDRESS2</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">ADDRESS3</property>
<property name="nativeName">ADDRESS3</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">ADDRESS4</property>
<property name="nativeName">ADDRESS4</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select distinct
a.person_name,
b.line2 address2,
b.line3 address3,
b.line4 address4
FROM v_mgmtprog_fee_person_year a
LEFT JOIN v_address_label b ON a.person_id = b.person_id
WHERE a.year = ?
AND a.management_program_id = ?
AND a.total_remaining_balance > 0
order by a.person_name]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
<property name="paddingTop">0pt</property>
<property name="paddingLeft">0pt</property>
<property name="paddingBottom">0pt</property>
<property name="paddingRight">0pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Mailing Label" id="589">
<property name="topMargin">0.5in</property>
<property name="leftMargin">0.19in</property>
<property name="bottomMargin">0.5in</property>
<property name="rightMargin">0in</property>
<property name="headerHeight">0in</property>
<property name="footerHeight">0in</property>
</simple-master-page>
</page-setup>
<body>
<list id="722">
<property name="fontFamily">"Times New Roman"</property>
<property name="masterPage">Mailing Label</property>
<property name="pageBreakBefore">always</property>
<property name="dataSet">Addresses</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">PERSON_NAME</property>
<text-property name="displayName">PERSON_NAME</text-property>
<expression name="expression" type="javascript">dataSetRow["PERSON_NAME"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">ADDRESS2</property>
<text-property name="displayName">ADDRESS2</text-property>
<expression name="expression" type="javascript">dataSetRow["ADDRESS2"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">ADDRESS3</property>
<text-property name="displayName">ADDRESS3</text-property>
<expression name="expression" type="javascript">dataSetRow["ADDRESS3"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">ADDRESS4</property>
<text-property name="displayName">ADDRESS4</text-property>
<expression name="expression" type="javascript">dataSetRow["ADDRESS4"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<property name="repeatHeader">false</property>
<property name="pageBreakInterval">30</property>
<detail>
<grid id="701">
<property name="marginTop">0pt</property>
<property name="marginLeft">6pt</property>
<property name="marginBottom">0pt</property>
<property name="marginRight">12pt</property>
<property name="paddingTop">0pt</property>
<property name="paddingLeft">0pt</property>
<property name="paddingBottom">0pt</property>
<property name="paddingRight">0pt</property>
<property name="display">inline</property>
<property name="height">1in</property>
<property name="width">2.5in</property>
<column id="702"/>
<row id="703">
<property name="height">0.2in</property>
<cell id="704">
<property name="paddingTop">0pt</property>
<property name="paddingLeft">0pt</property>
<property name="paddingBottom">0pt</property>
<property name="paddingRight">0pt</property>
<data id="748">
<property name="whiteSpace">nowrap</property>
<property name="resultSetColumn">PERSON_NAME</property>
</data>
</cell>
</row>
<row id="707">
<property name="height">0.2in</property>
<cell id="708">
<property name="paddingTop">0pt</property>
<property name="paddingLeft">0pt</property>
<property name="paddingBottom">0pt</property>
<property name="paddingRight">0pt</property>
<data id="749">
<property name="whiteSpace">nowrap</property>
<property name="resultSetColumn">ADDRESS2</property>
</data>
</cell>
</row>
<row id="709">
<property name="height">0.2in</property>
<cell id="710">
<property name="paddingTop">0pt</property>
<property name="paddingLeft">0pt</property>
<property name="paddingBottom">0pt</property>
<property name="paddingRight">0pt</property>
<data id="750">
<property name="whiteSpace">nowrap</property>
<property name="resultSetColumn">ADDRESS3</property>
</data>
</cell>
</row>
<row id="711">
<property name="height">0.2in</property>
<cell id="712">
<property name="paddingTop">0pt</property>
<property name="paddingLeft">0pt</property>
<property name="paddingBottom">0pt</property>
<property name="paddingRight">0pt</property>
<data id="751">
<property name="whiteSpace">nowrap</property>
<property name="resultSetColumn">ADDRESS4</property>
</data>
</cell>
</row>
<row id="705">
<property name="height">0.2in</property>
<cell id="764">
<property name="whiteSpace">nowrap</property>
</cell>
</row>
</grid>
</detail>
</list>
</body>
</report>
Previous Topic:BIRT Report Design, XML source, and Eclipse formatting
Next Topic:Need help on charting for pdf using API approach
Goto Forum:
  


Current Time: Fri Aug 22 07:49:18 EDT 2014

Powered by FUDForum. Page generated in 0.18774 seconds