MartinS1981
-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Downloads
Posts posted by MartinS1981
-
-
Then clearly either I'm doing something wrong or there is something wrong with 6.8 version. I've tried the settings you proposed but the chart is still empty. Previous settings were remainings of try and error process to show anything on the bar chart with the new dataset.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b -->
<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="SampleCSV" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="98d50966-545a-4b68-af9d-c4062b452be9">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="SampleCSV"/>
<subDataset name="Dataset1" uuid="0ad0b1a5-3579-4a7a-a5e3-87ef75f824d7">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="SampleCSV"/>
<queryString language="csv">
<![CDATA[]]>
</queryString>
<field name="Product" class="java.lang.String"/>
<field name="Count" class="java.lang.Integer"/>
<sortField name="Product"/>
<variable name="Variable_1" class="java.lang.Integer" resetType="Group" resetGroup="Product" calculation="Sum">
<variableExpression><![CDATA[$F{Count}]]></variableExpression>
<initialValueExpression><![CDATA[0]]></initialValueExpression>
</variable>
<group name="Product">
<groupExpression><![CDATA[$F{Product}]]></groupExpression>
</group>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<field name="Product" class="java.lang.String"/>
<field name="Count" class="java.lang.Integer"/>
<variable name="Variable_1" class="java.lang.Integer" resetType="Group" resetGroup="Product" calculation="Sum">
<variableExpression><![CDATA[$F{Count}]]></variableExpression>
<initialValueExpression><![CDATA[0]]></initialValueExpression>
</variable>
<group name="Product">
<groupExpression><![CDATA[$F{Product}]]></groupExpression>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<detail>
<band height="267" splitType="Stretch">
<barChart>
<chart evaluationTime="Report">
<reportElement x="342" y="67" width="200" height="200" uuid="27426e64-8bce-4491-b3cd-5570ff9ce7bf"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="Dataset1" uuid="d9db396e-3bcc-45e2-9ea2-d95d2bfad969">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{Product}]]></seriesExpression>
<categoryExpression><![CDATA[$F{Product}]]></categoryExpression>
<valueExpression><![CDATA[$V{Variable_1}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot/>
<itemLabel/>
<categoryAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</detail>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
-
I should have mentioned, that my data source is a CSV adapter with a file containing 16 records. I've created a new dataset with sorting by field "Product" bu in "Data Preview" rows are duplicated (first 16 rows are in the usual order and then there are another 16 rows sorted accordingly to the Product field set in Sorting tab. Also When I hooked it up to a bar chart, my chart is completely empty.
-
Hi folks,
my simplified data coming from CSV adapter is as follows:
Product Count A 10 A 5 B 7 A 1 I'd like to sum count of all products by group Product and later use it on a bar chart. Unfortunately, products are unsorted so A occurs multiple times so I cannot use a variable that sums it and resets on Product [Group]. How can I solve this problem/
How to sum by unsorted, multiplicated groups
in Products
Posted
@hozawa
Your solution works for me but you didn't create a separate dataset as you suggested in the first place. All you did was setting up a sortField in main report dataset. How can I achieve the same using separate subdataset?