<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="groups" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.callouts" value="##Thu Jan 21 16:11:21 CET 2010\ncallouts.4.text=Sum of FREIGHT with reset type group Country_First_letter\ncallouts.4.bounds=479,352,150,75\ncallouts.1.text=Use the Sample Database (HSQLDB test) datasource to run this report.\nTo run the database, select Help &gt; Samples &gt; Run Sample Database.\ncallouts.3.pins=559,257;\ncallouts.3.bounds=612,279,159,58\ncallouts.2.text=The evaluation time of this textfield is set to AUTO, to let JasperReports figure it out when the group is going to start. An alternative is to print directly the expression used for the gruop without relay to a variable.\ncallouts.4.pins=559,297;\ncallouts.2.bounds=-5,342,209,114\ncallouts.1.bounds=394,73,235,90\ncallouts.3.text=Sum of FREIGHT with reset type group Country\ncallouts.2.pins=105,135;"/>
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<queryString>
		<![CDATA[select * from  orders order by shipcountry]]>
	</queryString>
	<field name="ORDERID" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="CUSTOMERID" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="EMPLOYEEID" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="ORDERDATE" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="REQUIREDDATE" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPPEDDATE" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPVIA" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="FREIGHT" class="java.math.BigDecimal">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPNAME" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPADDRESS" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPCITY" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPREGION" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPPOSTALCODE" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPCOUNTRY" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<variable name="FREIGHT_1" class="java.math.BigDecimal" resetType="Group" resetGroup="Country" calculation="Sum">
		<variableExpression><![CDATA[$F{FREIGHT}]]></variableExpression>
	</variable>
	<variable name="FREIGHT_2" class="java.math.BigDecimal" resetType="Group" resetGroup="Country_First_letter" calculation="Sum">
		<variableExpression><![CDATA[$F{FREIGHT}]]></variableExpression>
	</variable>
	<variable name="First_Letter" class="java.lang.String" resetType="Group" resetGroup="Country_First_letter">
		<variableExpression><![CDATA[($F{SHIPCOUNTRY} == null ||
  $F{SHIPCOUNTRY}.length() == 0) ? "" : $F{SHIPCOUNTRY}.substring(0,1)]]></variableExpression>
	</variable>
	<group name="Country_First_letter">
		<groupExpression><![CDATA[($F{SHIPCOUNTRY} == null ||
 $F{SHIPCOUNTRY}.length() == 0) ? "" : $F{SHIPCOUNTRY}.substring(0,1)]]></groupExpression>
		<groupHeader>
			<band height="77">
				<textField evaluationTime="Auto">
					<reportElement mode="Opaque" x="0" y="0" width="108" height="74" backcolor="#F9AAAA"/>
					<textElement>
						<font size="52"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$V{First_Letter}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="34">
				<textField>
					<reportElement mode="Opaque" x="455" y="11" width="100" height="20" backcolor="#FFC9C9"/>
					<textElement/>
					<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{FREIGHT_2}]]></textFieldExpression>
				</textField>
				<textField>
					<reportElement mode="Opaque" x="44" y="11" width="395" height="20" backcolor="#FFC9C9"/>
					<textElement textAlignment="Right" markup="none">
						<font size="12"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA["Total freight of orders in country starting with the letter " + $V{First_Letter}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<group name="Country">
		<groupExpression><![CDATA[$F{SHIPCOUNTRY}]]></groupExpression>
		<groupHeader>
			<band height="36">
				<textField>
					<reportElement x="0" y="0" width="291" height="36"/>
					<textElement>
						<font size="24"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{SHIPCOUNTRY}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="32">
				<textField>
					<reportElement mode="Opaque" x="455" y="10" width="100" height="20" backcolor="#EDECEC"/>
					<textElement/>
					<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{FREIGHT_1}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement mode="Opaque" x="44" y="10" width="395" height="20" backcolor="#EDECEC"/>
					<textElement textAlignment="Right">
						<font size="12"/>
					</textElement>
					<text><![CDATA[Total freight in this country:]]></text>
				</staticText>
			</band>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="104" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="32" width="555" height="65"/>
				<textElement textAlignment="Justified" verticalAlignment="Top">
					<font size="14"/>
				</textElement>
				<text><![CDATA[Groups can be used to group data. Each group can have an header and a footer band.
The group expression is used as grouping criteria.]]></text>
			</staticText>
			<staticText>
				<reportElement x="0" y="1" width="555" height="31"/>
				<textElement textAlignment="Center" verticalAlignment="Top">
					<font size="20" isBold="false"/>
				</textElement>
				<text><![CDATA[Groups]]></text>
			</staticText>
		</band>
	</title>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band splitType="Stretch"/>
	</columnHeader>
	<detail>
		<band height="15" splitType="Stretch">
			<textField>
				<reportElement x="100" y="3" width="171" height="12"/>
				<textElement>
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SHIPNAME}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="281" y="3" width="158" height="12"/>
				<textElement>
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SHIPCITY}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="0" y="3" width="100" height="12"/>
				<textElement>
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{ORDERDATE}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="455" y="3" width="100" height="12"/>
				<textElement>
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{FREIGHT}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>
