<?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="report name" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<import value="java.util.*"/>
	<parameter name="Country_multi_select" class="java.util.Collection">
		<defaultValueExpression><![CDATA[new ArrayList(Arrays.asList(new String[] {"USA"}))]]></defaultValueExpression>
	</parameter>
	<parameter name="Cascading_state_multi_select" class="java.util.Collection">
		<defaultValueExpression><![CDATA[new ArrayList(Arrays.asList(new String[] {"CA"}))]]></defaultValueExpression>
	</parameter>
	<parameter name="Cascading_name_single_select" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT * FROM accounts
WHERE $X{IN, billing_address_state, Cascading_state_multi_select}
AND $X{IN, billing_address_country, Country_multi_select}
AND name = $P{Cascading_name_single_select}
ORDER BY billing_address_country, billing_address_state, name]]>
	</queryString>
	<field name="id" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="date_entered" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="date_modified" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="modified_user_id" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="assigned_user_id" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="created_by" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="name" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="parent_id" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="account_type" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="industry" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="annual_revenue" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="phone_fax" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="billing_address_street" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="billing_address_city" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="billing_address_state" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="billing_address_postalcode" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="billing_address_country" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="description" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="rating" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="phone_office" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="phone_alternate" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="email1" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="email2" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="website" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="ownership" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="employees" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="sic_code" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="ticker_symbol" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="shipping_address_street" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="shipping_address_city" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="shipping_address_state" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="shipping_address_postalcode" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="shipping_address_country" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="deleted" class="java.lang.Boolean">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<group name="Country">
		<groupExpression><![CDATA[$F{billing_address_country}]]></groupExpression>
		<groupHeader>
			<band height="50">
				<textField>
					<reportElement x="120" y="20" width="154" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_country}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement x="5" y="20" width="100" height="20"/>
					<textElement/>
					<text><![CDATA[Country]]></text>
				</staticText>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="50">
				<textField evaluationTime="Group" evaluationGroup="Country" pattern="#,##0">
					<reportElement x="644" y="16" width="144" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{Country_COUNT}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement x="237" y="16" width="100" height="20"/>
					<textElement/>
					<text><![CDATA[Accounts for Country]]></text>
				</staticText>
				<textField>
					<reportElement x="351" y="16" width="154" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_country}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<group name="State">
		<groupExpression><![CDATA[$F{billing_address_state}]]></groupExpression>
		<groupHeader>
			<band height="50">
				<textField>
					<reportElement x="120" y="14" width="120" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_state}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement x="5" y="14" width="100" height="20"/>
					<textElement/>
					<text><![CDATA[State]]></text>
				</staticText>
				<textField>
					<reportElement x="251" y="14" width="154" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_country}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="50">
				<staticText>
					<reportElement x="237" y="14" width="100" height="20"/>
					<textElement/>
					<text><![CDATA[Accounts for State]]></text>
				</staticText>
				<textField>
					<reportElement x="351" y="14" width="154" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_country}]]></textFieldExpression>
				</textField>
				<textField>
					<reportElement x="505" y="14" width="120" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_state}]]></textFieldExpression>
				</textField>
				<textField evaluationTime="Group" evaluationGroup="Country" pattern="#,##0">
					<reportElement x="644" y="14" width="144" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{State_COUNT}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<background>
		<band/>
	</background>
	<title>
		<band height="62">
			<textField>
				<reportElement x="5" y="0" width="215" height="28"/>
				<textElement>
					<font size="14"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Cascading parameter test"]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="285" y="0" width="270" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{Country_multi_select}.toString()]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="285" y="20" width="270" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{Cascading_state_multi_select}.toString()]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="285" y="40" width="270" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{Cascading_name_single_select}]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="33">
			<staticText>
				<reportElement x="0" y="13" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[Name]]></text>
			</staticText>
			<staticText>
				<reportElement x="251" y="13" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[Address]]></text>
			</staticText>
			<staticText>
				<reportElement x="505" y="13" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[City]]></text>
			</staticText>
			<staticText>
				<reportElement x="644" y="13" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[Account Count]]></text>
			</staticText>
		</band>
	</pageHeader>
	<columnHeader>
		<band height="13"/>
	</columnHeader>
	<detail>
		<band height="27">
			<textField>
				<reportElement x="0" y="0" width="237" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="251" y="0" width="243" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_street}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="505" y="0" width="144" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_city}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band height="16"/>
	</columnFooter>
	<pageFooter>
		<band height="18"/>
	</pageFooter>
	<summary>
		<band height="18"/>
	</summary>
</jasperReport>
