How to calculate average time? - mysql

I am trying to figure out how to take the average of the Time To Buildof the items.
This is the equation I have used to gather the time:
($F{MO_DATECOMPLETED}.getTime()-$F{MO_DATECREATED}.getTime()) / (24* 60 * 60 * 1000) + " days " +
(($F{MO_DATECOMPLETED}.getTime()-$F{MO_DATECREATED}.getTime()) / (60 * 60 * 1000)) % 24 + " hour(s), " +
(($F{MO_DATECOMPLETED}.getTime()-$F{MO_DATECREATED}.getTime()) / (60 * 1000)) % 60 + " minute(s)"
This are the photos of my disign and variables, along with my XML, to help explain my situation.
QUESTION: How do I fix my avgToBuild variable so that it averages all of the calculated Time To Build?
<?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="BOM Build Time" pageWidth="595" pageHeight="840" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="775a7e35-9af8-4206-a155-b05a478c35b0">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="bomNumber" class="java.lang.String">
<parameterDescription><![CDATA[BOM Number:]]></parameterDescription>
</parameter>
<parameter name="To" class="java.util.Date"/>
<parameter name="From" class="java.util.Date"/>
<queryString>
<![CDATA[SELECT
datediff(day,MO."DATECREATED",MO."DATECOMPLETED") AS dayToBuild,
COMPANY."NAME" AS COMPANY_NAME,
BOM."NUM" AS BOM_NUM,
MO."DATECREATED" AS MO_DATECREATED,
MO."NUM" AS MO_NUM,
MO."DATECOMPLETED" AS MO_DATECOMPLETED,
MOITEM."BOMID" AS MOITEM_BOMID,
MOITEM."MOID" AS MOITEM_MOID,
MOITEM."QTYTOFULFILL" AS MOITEM_QTYTOFULFILL,
BOMITEMTYPE."ID" AS BOMITEMTYPE_ID,
WO."NUM" AS WO_NUM
FROM
"BOM" BOM INNER JOIN "MOITEM" MOITEM ON BOM."ID" = MOITEM."BOMID"
INNER JOIN "MO" MO ON MOITEM."MOID" = MO."ID"
INNER JOIN "BOMITEMTYPE" BOMITEMTYPE ON MOITEM."TYPEID" = BOMITEMTYPE."ID"
INNER JOIN "WO" WO ON MOITEM."ID" = WO."MOITEMID",
"COMPANY" COMPANY
WHERE
BOM."NUM"=$P{bomNumber}
AND MO."DATECOMPLETED" BETWEEN $P{From} AND $P{To}
ORDER BY
3 ASC]]>
</queryString>
<field name="DAYTOBUILD" class="java.lang.Long"/>
<field name="COMPANY_NAME" class="java.lang.String"/>
<field name="BOM_NUM" class="java.lang.String"/>
<field name="MO_DATECREATED" class="java.sql.Timestamp"/>
<field name="MO_NUM" class="java.lang.String"/>
<field name="MO_DATECOMPLETED" class="java.sql.Timestamp"/>
<field name="MOITEM_BOMID" class="java.lang.Integer"/>
<field name="MOITEM_MOID" class="java.lang.Integer"/>
<field name="MOITEM_QTYTOFULFILL" class="java.lang.Double"/>
<field name="BOMITEMTYPE_ID" class="java.lang.Integer"/>
<field name="WO_NUM" class="java.lang.String"/>
<variable name="timeToBuild" class="java.lang.String">
<variableExpression><![CDATA[($F{MO_DATECOMPLETED}.getTime()- $F{MO_DATECREATED}.getTime()) / (24* 60 * 60 * 1000) + " days " +
(($F{MO_DATECOMPLETED}.getTime()-$F{MO_DATECREATED}.getTime()) / (60 * 60 * 1000)) % 24 + " hour(s), " +
(($F{MO_DATECOMPLETED}.getTime()-$F{MO_DATECREATED}.getTime()) / (60 * 1000)) % 60 + " minute(s)"]]></variableExpression>
</variable>
<variable name="avgTimeToBuild" class="java.lang.String" calculation="Average">
<variableExpression><![CDATA[$V{timeToBuild}]]></variableExpression>
</variable>
<title>
<band height="27" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="25" uuid="40060ef5-07fd-4875-9f81-10b65d60d11d"/>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{COMPANY_NAME}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="555" height="25" uuid="b17515a1-2396-49f1-ad96-452ce08d720e"/>
<textElement textAlignment="Center">
<font size="14"/>
</textElement>
<text><![CDATA[BOM Build Time Report]]></text>
</staticText>
<staticText>
<reportElement x="0" y="25" width="190" height="20" uuid="24836422-ce77-43c9-8268-a8f13d2d11b5"/>
<textElement textAlignment="Right">
<font size="14"/>
</textElement>
<text><![CDATA[Date Range:]]></text>
</staticText>
<textField>
<reportElement x="190" y="25" width="100" height="20" uuid="e25d36f8-e42b-4015-bc41-7bfbc9040119"/>
<textElement textAlignment="Right">
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{From}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="290" y="25" width="20" height="20" uuid="45821608-63dc-459f-b2c3-41a6156b72dd"/>
<textElement textAlignment="Center">
<font size="14"/>
</textElement>
<text><![CDATA[-]]></text>
</staticText>
<textField>
<reportElement x="310" y="25" width="100" height="20" uuid="05fd3fd8-735d-402c-9d98-bdd3f9f52378"/>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{To}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="24" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="75" height="20" uuid="b59f6065-7fc9-482d-9e08-e381ac697304"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[BOM #]]></text>
</staticText>
<staticText>
<reportElement x="80" y="0" width="100" height="20" uuid="4ec40990-bdfe-415d-a7ae-b50e315d00ef"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Start Date]]></text>
</staticText>
<staticText>
<reportElement x="185" y="0" width="100" height="20" uuid="032d2ae9-99fe-4c6f-8cf4-24b9c5367a44"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Finish Date]]></text>
</staticText>
<staticText>
<reportElement x="415" y="0" width="140" height="20" uuid="55b731d5-b826-4ee1-b7d2-4a83cabd4ef8"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Time To Build]]></text>
</staticText>
<staticText>
<reportElement x="290" y="0" width="50" height="20" uuid="807ee552-ea26-4891-bc72-a433aeab1866"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[QTY]]></text>
</staticText>
<staticText>
<reportElement x="345" y="0" width="50" height="20" uuid="cb39685d-f7c8-432f-9b69-454ff5fe2134"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[WO #]]></text>
</staticText>
<line>
<reportElement x="0" y="19" width="555" height="1" uuid="266ffac8-70a0-4756-9191-5de40f532d9f"/>
</line>
</band>
</columnHeader>
<detail>
<band height="24" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="75" height="20" isRemoveLineWhenBlank="true" uuid="3b256693-f18d-4ef9-89ec-7890481d1855"/>
<textFieldExpression><![CDATA[$F{BOM_NUM}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="80" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="7c01356e-4c95-4e15-9691-632e0b84946e"/>
<textFieldExpression><![CDATA[$F{MO_DATECREATED}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="185" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="516bc38e-99f3-486f-ae74-c8cfe6a5b5b1"/>
<textFieldExpression><![CDATA[$F{MO_DATECOMPLETED}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="415" y="0" width="140" height="20" isRemoveLineWhenBlank="true" uuid="aa538d4a-48ec-4b72-84ed-e9e889dcaee5"/>
<textElement>
<paragraph tabStopWidth="40"/>
</textElement>
<textFieldExpression><![CDATA[$V{timeToBuild}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="290" y="0" width="50" height="20" isRemoveLineWhenBlank="true" uuid="cf252514-6297-405d-a12e-6424332e6d10"/>
<textFieldExpression><![CDATA[$F{MOITEM_QTYTOFULFILL}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="345" y="0" width="50" height="20" isRemoveLineWhenBlank="true" uuid="6637a124-0145-4e56-b3eb-7af3bae5446e"/>
<textFieldExpression><![CDATA[$F{WO_NUM}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band height="22">
<staticText>
<reportElement x="0" y="0" width="150" height="20" uuid="5ac0e1eb-dc7b-4866-88aa-3c1a9c3ef4a9"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[Average Time To Build:]]></text>
</staticText>
<textField>
<reportElement x="150" y="0" width="150" height="20" uuid="860dd902-9791-443e-9a9d-3dedab365b23"/>
<textFieldExpression><![CDATA[$V{avgTimeToBuild}]]></textFieldExpression>
</textField>
</band>
</summary>

You need to calculate the average of the numeric value not the String value.
Lets calculate the average in milliseconds class="java.lang.Long"
<variable name="avgTimeToBuild" class="java.lang.Long" calculation="Average">
<variableExpression><![CDATA[$F{MO_DATECOMPLETED}.getTime()-$F{MO_DATECREATED}.getTime()]]></variableExpression>
</variable>
To display apply same expression as in "Time to Build" column using the variable $V{avgTimeToBuild}, even if in this case (since it in summary band) its not nessary I would put evaluationTime="Report" to make sure it's evaluated after displaying all records (if you move it in pageFooter this would be required)
<textField evaluationTime="Report">
<reportElement x="150" y="0" width="150" height="20" uuid="860dd902-9791-443e-9a9d-3dedab365b23"/>
<textFieldExpression><![CDATA[$V{avgTimeToBuild} / (24* 60 * 60 * 1000) + " days " + ($V{avgTimeToBuild} / (60 * 60 * 1000)) % 24 + " hour(s), " +($V{avgTimeToBuild} / (60 * 1000)) % 60 + " minute(s)"]]></textFieldExpression>
</textField>

Related

Jaspersoft jsonql iterate over list to get next element

I am using jaspersoft studio 6.6.0 for my report, and i have json as a datasource for my report, in my report there is a field to display next port name based on condition of current port, but i am not able to display that, my json is as like this
"routingLocs": [
{
"callOrder": 1,
"locCode": "ZWTHJ",
"isCurrentLoc": "N"
},
{
"callOrder": 2,
"locCode": "TRYAR",
"isCurrentLoc": "Y"
},
{
"callOrder": 3,
"locCode": "AUABP",
"isCurrentLoc": "N"
},
{
"callOrder": 4,
"locCode": "RAJPI",
"isCurrentLoc": "N"
}
]
now i have to display locCode of object which is next to object that has isCurrentLoc = "Y", for this i have created one field with expression as
<![CDATA[routingLocs..locCode(^.isCurrentLoc == "Y")]]>
This expression is printing "TRYAR" instead of "AUABP"
My field definition in JRXML to display the value is
<field name="nextPort" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression">
<![CDATA[routingLocs..locCode(^.isCurrentLoc == "Y")]]>
</property>
<fieldDescription><![CDATA[nextPort]]></fieldDescription>
</field>
please help me to fix this expression
Thanks in advance for any kind of support
You cannot land on a sibling element with a jsonql query, but you can filter the JSON in a separate subDataset to achieve what you want.
Provided there is some order in your JSON data, like the ascending order of the callOrder, you can start creating your main dataset with your filtering query, something like:
<queryString language="jsonql">
<![CDATA[routingLocs.*(isCurrentLoc == "Y")]]>
</queryString>
Then create a subDataset that accepts a MAIN_CALL_ORDER parameter and that will use the same JSON data that your main does:
<subDataset name="nextPortDataset" uuid="a8b8a64f-4c6b-4c28-91db-e10f28cef52c">
<property name="net.sf.jasperreports.data.adapter" value="./DataAdapter.xml"/>
<parameter name="MAIN_CALL_ORDER" class="java.lang.Integer"/>
<queryString language="jsonql">
<![CDATA[routingLocs.*(callOrder > $P{MAIN_CALL_ORDER})[0]]]>
</queryString>
<field name="locCode" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="locCode"/>
<fieldDescription><![CDATA[locCode]]></fieldDescription>
</field>
</subDataset>
Here, the query will produce the first item that has the callOrder greater than the one sent from the main dataset.
Then this dataset should be linked to a list that will be passed the parameter like so:
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="nextPortDataset" uuid="55c7173b-0b04-4d4f-bd80-48cfe1ef620c">
<datasetParameter name="MAIN_CALL_ORDER">
<datasetParameterExpression><![CDATA[$F{mainCallOrder}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
<jr:listContents height="30" width="460">
<textField>
<reportElement x="230" y="0" width="115" height="30" uuid="213ab052-9cdc-419a-8d3d-45db3bf6ef90"/>
<textFieldExpression><![CDATA[$F{locCode}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
A basic working JRXML would look like this:
<?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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e9573346-c7d0-4b7a-a838-d2ff5b7b9512">
<property name="net.sf.jasperreports.data.adapter" value="./DataAdapter.xml"/>
<subDataset name="nextPortDataset" uuid="a8b8a64f-4c6b-4c28-91db-e10f28cef52c">
<property name="net.sf.jasperreports.data.adapter" value="./DataAdapter.xml"/>
<parameter name="MAIN_CALL_ORDER" class="java.lang.Integer"/>
<queryString language="jsonql">
<![CDATA[routingLocs.*(callOrder > $P{MAIN_CALL_ORDER})[0]]]>
</queryString>
<field name="callOrder" class="java.lang.Integer">
<property name="net.sf.jasperreports.json.field.expression" value="callOrder"/>
<fieldDescription><![CDATA[callOrder]]></fieldDescription>
</field>
<field name="locCode" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="locCode"/>
<fieldDescription><![CDATA[locCode]]></fieldDescription>
</field>
<field name="isCurrentLoc" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="isCurrentLoc"/>
<fieldDescription><![CDATA[isCurrentLoc]]></fieldDescription>
</field>
</subDataset>
<queryString language="jsonql">
<![CDATA[routingLocs.*(isCurrentLoc == "Y")]]>
</queryString>
<field name="mainCallOrder" class="java.lang.Integer">
<property name="net.sf.jasperreports.jsonql.field.expression" value="callOrder"/>
<fieldDescription><![CDATA[mainCallOrder]]></fieldDescription>
</field>
<field name="mainLocCode" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="locCode"/>
<fieldDescription><![CDATA[mainLocCode]]></fieldDescription>
</field>
<field name="mainIsCurrentLoc" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="isCurrentLoc"/>
<fieldDescription><![CDATA[mainIsCurrentLoc]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="32" splitType="Stretch">
<staticText>
<reportElement x="115" y="0" width="115" height="30" uuid="4ec73015-1c44-441c-a80e-bff448923a29">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bff05bbe-0c73-4e55-adec-461fd0f2ebff"/>
</reportElement>
<text><![CDATA[callOrder]]></text>
</staticText>
<staticText>
<reportElement x="230" y="0" width="115" height="30" uuid="018825e6-aa24-4a11-85a4-760fa6cf913c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="cc7977d7-a541-4d3b-81d8-97be3451e130"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<text><![CDATA[locCode]]></text>
</staticText>
<staticText>
<reportElement x="345" y="0" width="115" height="30" uuid="16e13486-0a34-4c65-b512-00a4678c65f7">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="82e0773c-3e7d-4372-a44c-93a4bfcfd6b0"/>
</reportElement>
<text><![CDATA[isCurrentLoc]]></text>
</staticText>
<staticText>
<reportElement x="0" y="2" width="60" height="30" uuid="ad4e4685-2696-472c-a3b6-4a9961aeb6dc">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bff05bbe-0c73-4e55-adec-461fd0f2ebff"/>
</reportElement>
<text><![CDATA[Main Dataset]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="110" splitType="Stretch">
<textField>
<reportElement x="115" y="0" width="115" height="30" uuid="3bffc0f6-fb80-443a-b06d-ebbe2b669388">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bff05bbe-0c73-4e55-adec-461fd0f2ebff"/>
</reportElement>
<textFieldExpression><![CDATA[$F{mainCallOrder}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="0" width="115" height="30" uuid="1267f406-8492-4dd1-859a-a37f24ac545a">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="cc7977d7-a541-4d3b-81d8-97be3451e130"/>
</reportElement>
<textFieldExpression><![CDATA[$F{mainLocCode}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="345" y="0" width="115" height="30" uuid="522f3a23-a2b4-443d-9ca5-9abbd54a07df">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="82e0773c-3e7d-4372-a44c-93a4bfcfd6b0"/>
</reportElement>
<textFieldExpression><![CDATA[$F{mainIsCurrentLoc}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement x="0" y="80" width="560" height="30" uuid="859af22b-90ec-41fb-acf0-36d4acf2b90a"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="nextPortDataset" uuid="55c7173b-0b04-4d4f-bd80-48cfe1ef620c">
<datasetParameter name="MAIN_CALL_ORDER">
<datasetParameterExpression><![CDATA[$F{mainCallOrder}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
<jr:listContents height="30" width="560">
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="6db9b791-aaac-45e9-af0f-34546254b9e9"/>
<text><![CDATA[Filtering List]]></text>
</staticText>
<textField>
<reportElement x="115" y="0" width="115" height="30" uuid="ee03e48b-38dd-4814-ad7d-2549810c0991">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$F{callOrder}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="0" width="115" height="30" uuid="213ab052-9cdc-419a-8d3d-45db3bf6ef90"/>
<textFieldExpression><![CDATA[$F{locCode}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="345" y="0" width="115" height="30" uuid="a8ea32ea-150f-4d1f-8945-18c2b287c157"/>
<textFieldExpression><![CDATA[$F{isCurrentLoc}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</detail>
</jasperReport>
and produce the following output:
This sample needs a file-based data adapter that is linked to both main dataset and subDataset with this property:
<property name="net.sf.jasperreports.data.adapter" value="./DataAdapter.xml"/>
If you don't have a file-based data adapter, you could create one and export it to file from the Repository Explorer inside Jaspersoft Studio.

How to group dataset using JSON with Jasper Report?

I'm new to Jasper Report, and I'm using JSON as datasource. I have the following dataset, as a sample.
{"Northwind": {
"Customers": [
...
],
"Orders": [
{
"ShipPostalCode": 51100,
"ShippedDate": "1996-07-16",
"OrderDate": "1996-07-04",
"OrderID": 10248,
"Freight": 32.38,
"RequiredDate": "1996-08-01",
"ShipCity": "Berlin",
"ShipCountry": "Germany",
"EmployeeID": 5,
"ShipVia": 3,
"CustomerID": "ALFKI",
"ShipAddress": "59 rue de l'Abbaye",
"ShipName": "Vins et alcools Chevalier"
},
...
{
"ShipPostalCode": 44087,
"ShippedDate": "1996-07-10",
"OrderDate": "1996-07-05",
"OrderID": 10249,
"Freight": 11.61,
"RequiredDate": "1996-08-16",
"ShipCity": "Munich",
"ShipCountry": "Germany",
"EmployeeID": 6,
"ShipVia": 1,
"CustomerID": "RATTC",
"ShipAddress": "Luisenstr. 48",
"ShipName": "Martinez Gonzalez"
}
I'm passing the ShipCountry as parameter to my subreport, which is working as it should.
However, my template is showing the same data, twice, since it loops my dataset everytime for every object on my subset.
How group my orders by country ? How can I make to not show it duplicated ? Like this:
My country_orders_report.jrxml and country_order_list.jrxml code on GitHub. And my whole data, is very small :)
Hope that helps!
This happens because you have the same result for both queries in your main report and subreport.
In your main report - JsonCountryReport.jrxml - you have this query:
Northwind.Orders(ShipCountry == Germany)
that will produce 2 results. This implies rendering the subreport twice(for each query result).
Then, in your subreport - JsonCountryOrdersReport.jrxml - you have almost the same query:
Northwind.Orders(ShipCountry == $P{ShipCountry})
that will translate into the one above because you pass the same value for ShipCountry. The outcome should become obvious now.
You probably want to have:
Northwind.Customers(Country == Germany)
as your main report query with a Country field that you pass on to the subreport instead of ShipCountry.
EDIT: Since Orders' ShipCountry is only to be used, then you could use a ShipCountry group as #AlexK mentioned. However, placing the subreport in the groupHeader band is total overkill. You already have all the required data from your main query, so a subreport will not be necessary. You could restructure your main report as follows:
<?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="country_orders_report_new" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="bbe115b5-a5a0-4b39-9b73-7092dc59ab6d">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="JSON Data Adapter"/>
<style name="Sans_Normal" isDefault="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Sans_Normal_8" style="Sans_Normal" fontSize="8"/>
<style name="Sans_Bold" fontName="DejaVu Sans" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Sans_Bold_8" style="Sans_Bold" fontSize="8"/>
<queryString language="json">
<![CDATA[Northwind.Orders]]>
</queryString>
<field name="ShipCountry" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="ShipCountry"/>
</field>
<field name="Id" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="OrderID"/>
</field>
<field name="OrderDate" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="OrderDate"/>
</field>
<field name="ShipCity" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="ShipCity"/>
</field>
<field name="Freight" class="java.lang.Float">
<property name="net.sf.jasperreports.json.field.expression" value="Freight"/>
</field>
<sortField name="ShipCountry"/>
<variable name="OrderNumber" class="java.lang.Integer" resetType="Group" resetGroup="ShipCountryGroup" calculation="Count">
<variableExpression><![CDATA[0]]></variableExpression>
</variable>
<variable name="TotalFreight" class="java.lang.Float" resetType="Group" resetGroup="ShipCountryGroup" calculation="Sum">
<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
</variable>
<group name="ShipCountryGroup" isReprintHeaderOnEachPage="true">
<groupExpression><![CDATA[$F{ShipCountry}]]></groupExpression>
<groupHeader>
<band height="21">
<textField>
<reportElement style="Sans_Bold" x="5" y="5" width="100" height="15" isPrintWhenDetailOverflows="true" uuid="0aaeed6e-7ba1-4ab9-be59-d6ca702995fc"/>
<textFieldExpression><![CDATA[$F{ShipCountry}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="20" width="515" height="1" isPrintWhenDetailOverflows="true" uuid="6d76c22c-329f-4e77-a886-8580d3cb6bc1"/>
</line>
</band>
<band height="14">
<frame>
<reportElement mode="Opaque" x="0" y="2" width="356" height="10" forecolor="#CCFFFF" backcolor="#CCFFFF" uuid="e9af134f-31eb-48be-bd9b-292188f2554f"/>
<staticText>
<reportElement style="Sans_Bold_8" mode="Opaque" x="0" y="0" width="48" height="10" backcolor="#CCFFFF" uuid="62e5e770-7b05-4ecd-a254-ab0c7f643a37"/>
<textElement textAlignment="Right"/>
<text><![CDATA[ID]]></text>
</staticText>
<staticText>
<reportElement style="Sans_Bold_8" mode="Opaque" x="54" y="0" width="87" height="10" backcolor="#CCFFFF" uuid="c472f825-47f4-4e16-a782-cc4b02572cb0"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Order Date]]></text>
</staticText>
<staticText>
<reportElement style="Sans_Bold_8" mode="Opaque" x="146" y="0" width="108" height="10" backcolor="#CCFFFF" uuid="89b5edba-1606-4f5d-89cb-144042c1fcdd"/>
<text><![CDATA[Ship City]]></text>
</staticText>
<staticText>
<reportElement style="Sans_Bold_8" mode="Opaque" x="259" y="0" width="92" height="10" backcolor="#CCFFFF" uuid="e7c6fbe3-ecb2-4c65-83d6-7c813448cec6"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Freight]]></text>
</staticText>
</frame>
</band>
</groupHeader>
<groupFooter>
<band height="14">
<frame>
<reportElement mode="Opaque" x="0" y="2" width="356" height="10" forecolor="#33CCCC" backcolor="#33CCCC" uuid="084cfbb4-f390-4302-8bf5-2e65b34829b8"/>
<staticText>
<reportElement style="Sans_Bold_8" mode="Opaque" x="160" y="0" width="67" height="10" backcolor="#33CCCC" uuid="06753d49-aed5-46c8-be06-b107f81d7c2f"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Total :]]></text>
</staticText>
<textField>
<reportElement style="Sans_Bold_8" mode="Opaque" x="227" y="0" width="27" height="10" backcolor="#33CCCC" uuid="d8edf4da-1e47-45ec-bbf3-f63b3bf0b93b"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{OrderNumber}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00">
<reportElement style="Sans_Bold_8" mode="Opaque" x="259" y="0" width="92" height="10" backcolor="#33CCCC" uuid="a713b487-68a2-4391-a231-9bf9aa740090"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TotalFreight}]]></textFieldExpression>
</textField>
</frame>
</band>
</groupFooter>
</group>
<title>
<band height="50">
<line>
<reportElement x="0" y="0" width="515" height="1" uuid="fc148b4e-50df-4a12-aa14-8505a4cfa6e1"/>
</line>
<staticText>
<reportElement style="Sans_Normal" x="0" y="10" width="515" height="30" uuid="5bf7651c-cd6b-4eaf-b65a-1413d60faab0"/>
<textElement textAlignment="Center">
<font size="22"/>
</textElement>
<text><![CDATA[Country Orders Report]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="21">
<staticText>
<reportElement style="Sans_Bold" mode="Opaque" x="0" y="5" width="515" height="15" forecolor="#FFFFFF" backcolor="#333333" uuid="da0f1cad-f552-424b-bf19-b41cabbfa4ac"/>
<text><![CDATA[Country Order List]]></text>
</staticText>
</band>
</pageHeader>
<detail>
<band height="14">
<textField>
<reportElement style="Sans_Normal_8" x="0" y="2" width="51" height="10" uuid="ec54687d-3c95-4647-9db5-fa71a6e81009"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{Id}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="yyyy, MMM dd">
<reportElement style="Sans_Normal_8" positionType="Float" x="54" y="2" width="87" height="10" uuid="a112ba7b-c321-467c-91ec-ffb513c23338"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{OrderDate}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="Sans_Normal_8" positionType="Float" x="146" y="2" width="108" height="10" uuid="6a61edb3-239e-4791-a046-a6459343ac07"/>
<textFieldExpression><![CDATA[$F{ShipCity}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00">
<reportElement style="Sans_Normal_8" positionType="Float" x="259" y="2" width="92" height="10" uuid="61a8a117-6a43-46a7-9b96-10c5beb578ab"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{Freight}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="40">
<line>
<reportElement x="0" y="10" width="515" height="1" uuid="1371178a-a590-4616-affe-a4e1a24bcc84"/>
</line>
<textField>
<reportElement x="200" y="20" width="80" height="15" uuid="3eb302d8-0855-4f82-a666-3c9628dce372"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="280" y="20" width="75" height="15" uuid="86f46fca-dbcb-4a60-b2f7-f8da6a4224f7"/>
<textFieldExpression><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>

How to get dynamic no of tables using json

I want to create Jasper Report with Dynamic no of tables.FOR EXAMPLE:
User 1 - 5 tables
User 2 - 3 tables
User 3 - 6 tables
I tried with list option but my tables are not visible and number of pages are getting increased.
<subDataset name="tableDataSet" uuid="c72d8dbd-d63e-411b-862d-a0d6e1e25d37">
<queryString language="json">
<![CDATA[tableData]]>
</queryString>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[description]]></fieldDescription>
</field>
</subDataset>
<subDataset name="listDataSet" uuid="c72d8dbd-d63e-411b-862d-a0d6e1e25d37">
<queryString language="json">
<![CDATA[listData]]>
</queryString>
<field name="tableData" class="java.lang.String">
<fieldDescription><![CDATA[tableData]]></fieldDescription>
</field>
</subDataset>
<queryString language="json">
<![CDATA[mainDataSet]]>
</queryString>
<field name="listData" class="java.lang.String">
<fieldDescription><![CDATA[listData]]></fieldDescription>
</field>
<componentElement>
<reportElement x="-1" y="170" width="830" height="150" uuid="ab0272db-d740-42c9-94e5-238a2cc4a63e"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="listDataSet" uuid="f80306fb-80fc-405b-b90d-f9fe6b6ee2e1">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("listData")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="150" width="830">
<componentElement>
<reportElement positionType="Float" x="0" y="67" width="825" height="76" uuid="6a8e89c4-d4ea-4d8f-b932-8fbb24d00725"/>
<jr:table>
<datasetRun subDataset="tableDataSet" uuid="6ab7d349-34c8-4db7-bf3c-4e638ca36f5c">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("tableData")]]></dataSourceExpression>
</datasetRun>
<jr:column width="100" uuid="aae649c4-6a69-485f-8a0d-87022df793ee">
<jr:columnHeader style="colBotLeftLine" height="30">
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="795dac43-0ff0-482c-89a0-7dac3b27d513"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[DESCRIPTION]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="footerBotLeftLine" height="20">
<staticText>
<reportElement x="0" y="0" width="100" height="20" uuid="795dac43-0ff0-482c-89a0-7dac3b27d513"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Grand Total]]></text>
</staticText>
</jr:columnFooter>
<jr:detailCell height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="100" height="20" uuid="734834e8-5896-4355-9454-6b188e86bfff"/>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
Json Data.
{mainDataSet :
[
{CompanyName : "XYZ",
listData:
[
{tableId:1,
tableName:"Table One",
tableData:
[
{description:"Table One Row Data One "},
{description:"Table One Row Data Two"}
]
},
{tableId:2,
tableName:"Table Two",
tableData:
[
{description:"Table Two Row Data One "},
{description:"Table Two Row Data Two"}
]
}
]
}
]
}
mainDataSet is my Report Data Set, listData is the data for list and tableData is the one i want to display in my tables.
NOTE
If I remove the
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("tableData")]]></dataSourceExpression>
and put
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
Then Two tables are created with null values.
The query to main report let's leave it blank (and keep the mainDataSet node)
<queryString language="json"><![CDATA[]]></queryString>
Define the CompanyName field as
<field name="CompanyName" class="java.lang.String">
<fieldDescription><![CDATA[mainDataSet[0].CompanyName]]></fieldDescription>
</field>
The dataSourceExpression to pass to the jr:list
<datasetRun subDataset="listDataSet" uuid="71276e30-7777-44ae-b6d9-2087a4c51ca3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("mainDataSet.listData")]]></dataSourceExpression>
</datasetRun>
Hence point to the mainDataSet.listData
The dataSourceExpression to pass to the table (we are now in the listData)
<datasetRun subDataset="tableDataSet" uuid="5bca90cb-1473-4ff6-82fc-1da5ae4fb44c">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("tableData")]]></dataSourceExpression>
</datasetRun>

jassper-reports - csv formatting

I've got the following jasper file:
This file should create a csv file and it also is. Though every 14th record is malformed (see csv under the jasper file). Has anyone got any idea why?
<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="statisticsTBT" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="6719b7f6-2c0e-4979-b55c-8db017b6df05">
<property name="ireport.zoom" value="3.797498335832415"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="id" class="java.lang.Long"/>
<field name="code" class="java.lang.String"/>
<field name="dateReception" class="java.util.Date"/>
<field name="dateInput" class="java.util.Date"/>
<field name="dateClosure" class="java.util.Date"/>
<field name="dateSigned" class="java.util.Date"/>
<field name="dateSignedDef" class="java.util.Date"/>
<field name="startBemiddeling" class="java.util.Date"/>
<field name="endBemiddeling" class="java.util.Date"/>
<field name="startRechtsgeding" class="java.util.Date"/>
<field name="endRechtsgeding" class="java.util.Date"/>
<field name="startHoofdbestuur" class="java.util.Date"/>
<field name="endHoofdbestuur" class="java.util.Date"/>
<field name="initialServiceDate" class="java.util.Date"/>
<field name="dossiersInTreatmentRecp" class="java.lang.String"/>
<field name="dossiersInTreatmentClose" class="java.lang.String"/>
<field name="dossierType" class="java.lang.String"/>
<field name="initialServiceCode" class="java.lang.String"/>
<field name="cadastralIncome" class="java.lang.Integer"/>
<field name="proposedCadastralIncome" class="java.lang.Integer"/>
<field name="cadastralIncomeDef" class="java.lang.Integer"/>
<field name="reasonInValidDef" class="java.lang.String"/>
<field name="fiscalYear" class="java.lang.Integer"/>
<detail>
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="15" height="20" uuid="8bc70924-17fc-4371-bf24-bdcb5bd1a082"/>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="15" y="0" width="15" height="20" uuid="5a00c878-5a07-4556-ac59-ca93488d1c1a"/>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="30" y="0" width="15" height="20" uuid="33a84a35-106c-4843-9ade-628ebccc122f"/>
<textFieldExpression><![CDATA[$F{dateReception}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="45" y="0" width="15" height="20" uuid="24e5e1fc-2a96-4c4e-8979-142912148617"/>
<textFieldExpression><![CDATA[$F{dateInput}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="60" y="0" width="15" height="20" uuid="aa9dfe9e-705e-48ba-8bc5-78681421f0e2"/>
<textFieldExpression><![CDATA[$F{dateClosure}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="75" y="0" width="15" height="20" uuid="50776a2e-ea89-469c-80f5-a09ed923edff"/>
<textFieldExpression><![CDATA[$F{dateSigned}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="90" y="0" width="15" height="20" uuid="2784ebd9-380b-4ed9-9d84-6ca6b8d94b4c"/>
<textFieldExpression><![CDATA[$F{dateSignedDef}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="105" y="0" width="15" height="20" uuid="033adaec-b48b-4f05-a62b-3b8624affc62"/>
<textFieldExpression><![CDATA[$F{startBemiddeling}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="120" y="0" width="15" height="20" uuid="7ba5da83-fbe9-4cc3-90b5-cb09e8eab5e4"/>
<textFieldExpression><![CDATA[$F{endBemiddeling}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="135" y="0" width="15" height="20" uuid="b78d39ea-ba72-44dd-8d8a-97d69f910489"/>
<textFieldExpression><![CDATA[$F{startRechtsgeding}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="150" y="0" width="15" height="20" uuid="fc174497-43b4-40f6-b800-8d463f583416"/>
<textFieldExpression><![CDATA[$F{endRechtsgeding}]]></textFieldExpression>
</textField>
</band>
</detail>
11: 727, null, 17/02/14 0:00, 17/02/14 0:00, null, null, null, null, null, null, null
12: 729, null, 17/02/14 0:00, 17/02/14 0:00, null, null, null, null, null, null, null
13: 730, null, 14/02/14 0:, 17/02/14 0:, null, null, null, null, null, null, null
14: , , 00, 00, , , , , , ,
notice how row 14 takes the 00 and 00 from row 13.. It's the exact same result on row 28, 42, ...

Charts with Jasper Plugin does not show in Html format

I am using Jasper plugin to create charts in my app, I create a report with iReports and setup the chart, when I click on preview button the chart show well in iReports.
Then I copy the file to my reports app folder, I put a jasper tag in a list.gsp with PDF and HTML formats, run de application, and display the view, when I clic on PDF format the chart show well, but when I clic on HTML format the page show a broken image; the page tried to find the 'nullimg_0_0_9' image but it does not find it.
I put the report file in //web-app/reports/GraficaOperacionComercialProgramada.jrxml.
I am using Grails 1.3.6, Jasper Plugin 1.1.6.3 and iReports 4.0 on Ubuntu 10.10.
Any one know what I am do wrong?.
This is the code in my list.gsp:
<g:jasperReport
jasper="GraficaOperacionComercialProgramada"
format="${message(code: 'global.formatosReportes.label')}"
name="Gráfica sobre el total de carga por tipo de operación">
<br>
</g:jasperReport>
This is the report's code:
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="GraficaOperacionComercialProgramada2" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
</textElement>
<text><![CDATA[Gráfica Concepto - Total de carga por categoría]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="36" y="0" width="100" height="20"/>
<textElement>
</textElement>
<text><![CDATA[categoria]]></text>
</staticText>
<staticText>
<reportElement x="220" y="0" width="100" height="20"/>
<textElement>
</textElement>
<text><![CDATA[totalPasajeros]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="22" splitType="Stretch">
<textField>
<reportElement x="36" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{categoria}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="220" y="2" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{totalPasajeros}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="340" splitType="Stretch">
<pieChart>
<chart>
<reportElement x="0" y="0" width="572" height="340"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset>
<keyExpression><![CDATA[$F{categoria}]]></keyExpression>
<valueExpression><![CDATA[$F{totalPasajeros}]]></valueExpression>
<labelExpression><![CDATA[$F{categoria}]]></labelExpression>
</pieDataset>
<piePlot>
<plot/>
<itemLabel color="#000000" backgroundColor="#FFFFFF"/>
</piePlot>
</pieChart>
</band>
</summary>
</jasperReport>
Thanks in advance, ESalomon.
It sounds like you need to define your reports directory for jasper plugin. In grails-app/conf/Config.groovy make sure you have property named jasper.dir.reports and its value should be a full path to your jasper or jrxml files.