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

Chart for main dataset or parameters for sub dataset


caps_lock9

Recommended Posts

Good day.

Could you help me please?

I try to write report for JasperReport. Report with charts. But my reports isn’t working with MAIN DATASET, it’s working only with SUB DATASET. This problem is important for me, because I need use parameters. Use parameters with sub dataSet is second problem for me. (maybe you can give me link with explanations?) I use iReport 5.6.0, TIBCO JasperSoft Studio 6.0.3, Jasper Server 6.0.1 

 

For earlier Thank you very much.

 

This code (working only number 1 (sub dataset), number 2 isn’t working):

 

 

<?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="chart" language="groovy" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="685d5c60-f947-4765-ba91-b0ea7c7ce771">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="dateSet1" uuid="34dce292-9dd8-4008-b5ea-858a7abf263c">
<queryString language="SQL">
<![CDATA[select e."type", count(*)
from MON_FUNC.V_EVENTS E
where  e."type" is not null
group by e."type"]]>
</queryString>
<field name="type" class="java.lang.String"/>
<field name="COUNT(*)" class="java.math.BigDecimal"/>
</subDataset>
<queryString>
<![CDATA[select e."type", count(*) as count
from MON_FUNC.V_EVENTS E
where  e."type" is not null
group by e."type"]]>
</queryString>
<field name="type" class="java.lang.String"/>
<field name="COUNT" class="java.math.BigDecimal"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="32" splitType="Stretch">
<staticText>
<reportElement x="61" y="0" width="100" height="32" uuid="8ac52162-9ad4-427b-a63d-9cf14750a3e3"/>
<textElement>
<font fontName="Arial" size="24"/>
</textElement>
<text><![CDATA[#1]]></text>
</staticText>
<staticText>
<reportElement x="380" y="0" width="100" height="32" uuid="efe31290-567d-43ed-9e67-4f794d24823f"/>
<textElement>
<font fontName="Arial" size="24"/>
</textElement>
<text><![CDATA[#2]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="131" splitType="Stretch">
<pieChart>
<chart>
<reportElement x="0" y="0" width="204" height="131" uuid="d5e7b798-8032-4eba-bc9c-a658aafcdfa5"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset>
<dataset>
<datasetRun subDataset="dateSet1" uuid="9f9177d0-68bd-4882-8a2f-adda6595b67e"/>
</dataset>
<keyExpression><![CDATA[$F{type}]]></keyExpression>
<valueExpression><![CDATA[$F{COUNT(*)}]]></valueExpression>
</pieDataset>
<piePlot>
<plot/>
<itemLabel/>
</piePlot>
</pieChart>
<pieChart>
<chart>
<reportElement x="351" y="0" width="204" height="131" uuid="c072e23e-3e5d-4d9d-8bbe-a3c11701e5a0"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset>
<keyExpression><![CDATA[$F{type}]]></keyExpression>
<valueExpression><![CDATA[$F{COUNT}]]></valueExpression>
</pieDataset>
<piePlot>
<plot/>
<itemLabel/>
</piePlot>
</pieChart>
</band>
</pageHeader>
</jasperReport>
 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...