Jump to content
We've recently updated our Privacy Statement, available here ×

Data not selected based parameters in Crosstab Report using iReport Designer


golfmaniac.wood

Recommended Posts

I have a Report (using iReport 5.6.0) using the Crosstab component and I am using an XML data source, I have also added 2 parameters. My expectation is that when I pass the parameters into the report when prompted, the Report will select only the records that match the Parameters string that I provide but this is not the case. I need some help with (1) How to format the XML data source, i.e. do I need to rearrange the elements/tags (2) Modify the Report so that when the parameters are passed the records will only display those records matching the ClinicType parameter and ActivityDate.

I will post the XMl and JRXML file after.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

the XML data file is as shown

<?xml version="1.0" encoding="UTF-8"?><VSEE3SpecialtyCare>  <VAFacility>    <Facility ID="123456" Name="WHR Clinic" ActivityDate="2014-08-31" ClinicType="Dermatology"> <Measure ActivityDate="2014-08-31" MeasureName="UniquePatients" ValueType="Actual" Value="4366"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="Established-to-New-Ratio" ValueType="Numerator" Value="3498"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="Established-to-New-Ratio" ValueType="Denominator" Value="1102"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="NewPatientwithin14days" ValueType="Numerator" Value="974"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="NewPatientwithin14days" ValueType="Denominator" Value="3243"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="NewPatientwithin14days" ValueType="Target" Value="51"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="DefaultAppointmentLength" ValueType="Actual" Value="35"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="CalculatedSlotLength" ValueType="Actual" Value="37"><ClinicType>Dermatology</ClinicType></Measure>  </Facility>  <Facility ID="123456" Name="WHR Clinic" ActivityDate="2014-08-31" ClinicType="Dietary"> <Measure ActivityDate="2014-08-31" MeasureName="UniquePatients" ValueType="Actual" Value="4563"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="Established-to-New-Ratio" ValueType="Numerator" Value="5598"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="Established-to-New-Ratio" ValueType="Denominator" Value="1425"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="NewPatientwithin14days" ValueType="Numerator" Value="658"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="NewPatientwithin14days" ValueType="Denominator" Value="1264"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="NewPatientwithin14days" ValueType="Target" Value="43"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="DefaultAppointmentLength" ValueType="Actual" Value="40"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-08-31" MeasureName="CalculatedSlotLength" ValueType="Actual" Value="33"><ClinicType>Dietary</ClinicType></Measure>  </Facility>    <Facility ID="123456" Name="WHR Clinic" ActivityDate="2014-07-31" ClinicType="Dietary"> <Measure ActivityDate="2014-07-31" MeasureName="UniquePatients" ValueType="Actual" Value="5003"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="Established-to-New-Ratio" ValueType="Numerator" Value="5450"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="Established-to-New-Ratio" ValueType="Denominator" Value="1530"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="NewPatientwithin14days" ValueType="Numerator" Value="595"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="NewPatientwithin14days" ValueType="Denominator" Value="1363"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="NewPatientwithin14days" ValueType="Target" Value="42"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="DefaultAppointmentLength" ValueType="Actual" Value="39"><ClinicType>Dietary</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="CalculatedSlotLength" ValueType="Actual" Value="31"><ClinicType>Dietary</ClinicType></Measure>  </Facility>    <Facility ID="123456" Name="WHR Clinic" ActivityDate="2014-07-31" ClinicType="Dermatology"> <Measure ActivityDate="2014-07-31" MeasureName="UniquePatients" ValueType="Actual" Value="4754"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="Established-to-New-Ratio" ValueType="Numerator" Value="3721"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="Established-to-New-Ratio" ValueType="Denominator" Value="1205"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="NewPatientwithin14days" ValueType="Numerator" Value="922"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="NewPatientwithin14days" ValueType="Denominator" Value="4001"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="NewPatientwithin14days" ValueType="Target" Value="49"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="DefaultAppointmentLength" ValueType="Actual" Value="36"><ClinicType>Dermatology</ClinicType></Measure> <Measure ActivityDate="2014-07-31" MeasureName="CalculatedSlotLength" ValueType="Actual" Value="35"><ClinicType>Dermatology</ClinicType></Measure>  </Facility>  </VAFacility></VSEE3SpecialtyCare>[/code]

the JRXML code is as shown

<?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="Demo_Report_SpecialtyCare" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3041eb9a-189a-40c1-af2e-4856b42b4fb4"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <style name="Crosstab Data Text" hAlign="Center"/> <parameter name="ClinicType" class="java.lang.String"/> <parameter name="ActivityDate" class="java.lang.String">  <parameterDescription><![CDATA[Enter Activity Date Here]]></parameterDescription> </parameter> <queryString language="xPath">  <![CDATA[/VSEE3SpecialtyCare/VAFacility/Facility/Measure]]> </queryString> <field name="ID" class="java.lang.String">  <fieldDescription><![CDATA[/VSEE3SpecialtyCare/VAFacility/Facility/@ID]]></fieldDescription> </field> <field name="Name" class="java.lang.String">  <fieldDescription><![CDATA[/VSEE3SpecialtyCare/VAFacility/Facility/@Name]]></fieldDescription> </field> <field name="ActivityDate" class="java.lang.String">  <fieldDescription><![CDATA[@ActivityDate]]></fieldDescription> </field> <field name="MeasureName" class="java.lang.String">  <fieldDescription><![CDATA[@MeasureName]]></fieldDescription> </field> <field name="ValueType" class="java.lang.String">  <fieldDescription><![CDATA[@ValueType]]></fieldDescription> </field> <field name="Value" class="java.lang.String">  <fieldDescription><![CDATA[@Value]]></fieldDescription> </field> <field name="ClinicType" class="java.lang.String">  <fieldDescription><![CDATA[/VSEE3SpecialtyCare/VAFacility/Facility/Measure/ClinicType]]></fieldDescription> </field> <background>  <band splitType="Stretch"/> </background> <summary>  <band height="78">   <crosstab>    <reportElement x="0" y="0" width="752" height="78" uuid="bf2497ec-d2ed-4a72-9bb0-94bbdc433de1"/>    <rowGroup name="ActivityDate" width="70">     <bucket class="java.lang.String">      <bucketExpression><![CDATA[$F{ActivityDate}]]></bucketExpression>     </bucket>     <crosstabRowHeader>      <cellContents backcolor="#1E90FF" mode="Opaque">       <box>        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>       </box>       <textField>        <reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25" forecolor="#FFFFFF" uuid="228b8e58-0df1-495c-9f44-8a8d322fa48b"/>        <textElement verticalAlignment="Middle">         <font isBold="true"/>        </textElement>        <textFieldExpression><![CDATA[$V{ActivityDate}]]></textFieldExpression>       </textField>      </cellContents>     </crosstabRowHeader>     <crosstabTotalRowHeader>      <cellContents/>     </crosstabTotalRowHeader>    </rowGroup>    <rowGroup name="MeasureName" width="168">     <bucket class="java.lang.String">      <bucketExpression><![CDATA[$F{MeasureName}]]></bucketExpression>     </bucket>     <crosstabRowHeader>      <cellContents backcolor="#1E90FF" mode="Opaque">       <box>        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>       </box>       <textField>        <reportElement style="Crosstab Data Text" x="0" y="0" width="168" height="25" forecolor="#FFFFFF" uuid="e171017b-f205-4678-8464-05a5d1137df9"/>        <textElement verticalAlignment="Middle">         <font isBold="true"/>        </textElement>        <textFieldExpression><![CDATA[$V{MeasureName}]]></textFieldExpression>       </textField>      </cellContents>     </crosstabRowHeader>     <crosstabTotalRowHeader>      <cellContents/>     </crosstabTotalRowHeader>    </rowGroup>    <columnGroup name="ClinicType" height="30">     <bucket class="java.lang.String">      <bucketExpression><![CDATA[$F{ClinicType}]]></bucketExpression>     </bucket>     <crosstabColumnHeader>      <cellContents backcolor="#1E90FF" mode="Opaque">       <box>        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>       </box>       <textField>        <reportElement style="Crosstab Data Text" x="0" y="0" width="69" height="30" forecolor="#FFFFFF" uuid="d62b00fa-b8d5-451f-8624-c13cffc36eb9"/>        <textElement verticalAlignment="Middle">         <font isBold="true"/>        </textElement>        <textFieldExpression><![CDATA[$V{ClinicType}]]></textFieldExpression>       </textField>      </cellContents>     </crosstabColumnHeader>     <crosstabTotalColumnHeader>      <cellContents/>     </crosstabTotalColumnHeader>    </columnGroup>    <columnGroup name="ValueType" height="30">     <bucket class="java.lang.String">      <bucketExpression><![CDATA[$F{ValueType}]]></bucketExpression>     </bucket>     <crosstabColumnHeader>      <cellContents backcolor="#1E90FF" mode="Opaque">       <box>        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>       </box>       <textField>        <reportElement style="Crosstab Data Text" x="0" y="0" width="77" height="30" forecolor="#FFFFFF" uuid="9186c844-5102-4906-90a9-9a62f5b943cc"/>        <textElement verticalAlignment="Middle">         <font isBold="true"/>        </textElement>        <textFieldExpression><![CDATA[$V{ValueType}]]></textFieldExpression>       </textField>      </cellContents>     </crosstabColumnHeader>     <crosstabTotalColumnHeader>      <cellContents/>     </crosstabTotalColumnHeader>    </columnGroup>    <measure name="ValueMeasure" class="java.lang.String" calculation="First">     <measureExpression><![CDATA[$F{Value}]]></measureExpression>    </measure>    <crosstabCell width="78" height="25">     <cellContents>      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField isBlankWhenNull="true">       <reportElement style="Crosstab Data Text" x="0" y="0" width="77" height="25" uuid="00b03887-773a-4b46-b939-74b3fb9e702e"/>       <box>        <pen lineWidth="0.75" lineColor="#0066CC"/>        <topPen lineWidth="0.75" lineColor="#0066CC"/>        <leftPen lineWidth="0.75" lineColor="#0066CC"/>        <bottomPen lineWidth="0.75" lineColor="#0066CC"/>        <rightPen lineWidth="0.75" lineColor="#0066CC"/>       </box>       <textElement verticalAlignment="Middle"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell height="25" rowTotalGroup="ActivityDate">     <cellContents backcolor="#005AB3" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF" uuid="b2400dd4-3e9c-4f6f-86d4-f4ade7ff83f1"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell width="50" columnTotalGroup="ClinicType">     <cellContents backcolor="#005AB3" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF" uuid="ad39dc08-ebff-4411-9c41-fd605689d542"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell rowTotalGroup="ActivityDate" columnTotalGroup="ClinicType">     <cellContents backcolor="#005AB3" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF" uuid="9df7870f-cfcc-4d30-b5fb-aa5eee13133e"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell width="50" columnTotalGroup="ValueType">     <cellContents backcolor="#BFE0FF" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="5c24f876-7910-4ec8-aa87-788eae658e12"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell rowTotalGroup="ActivityDate" columnTotalGroup="ValueType">     <cellContents backcolor="#005AB3" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF" uuid="75687155-d898-45fa-a961-37cbf583720a"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell height="25" rowTotalGroup="MeasureName">     <cellContents backcolor="#BFE0FF" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="b1e7ff12-37ec-4f06-8e62-e33227aac7fb"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell rowTotalGroup="MeasureName" columnTotalGroup="ClinicType">     <cellContents backcolor="#005AB3" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF" uuid="ea59818b-2478-4276-9575-2261139cd1f1"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>    <crosstabCell rowTotalGroup="MeasureName" columnTotalGroup="ValueType">     <cellContents backcolor="#BFE0FF" mode="Opaque">      <box>       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/>      </box>      <textField>       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="0eb140af-6d66-4f2f-b397-d54a9777da0a"/>       <textFieldExpression><![CDATA[$V{ValueMeasure}]]></textFieldExpression>      </textField>     </cellContents>    </crosstabCell>   </crosstab>  </band> </summary></jasperReport>[/code]

The  preview of the report looks like this

/sites/default/files/images/ScrnShot_DemoReportViewer.JPG

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...