2

I'm working on CVC component in Jasper Studio. It is working fine with the "ReportMainDataset" but when I'm using the "Sub Dataset" it is not plotting.

Just wanted to know does CVC component works with "Sub Dataset" or not. If works, guide me how can I achieve this.

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
GeekExplorer
  • 260
  • 2
  • 6
  • 23

1 Answers1

0

The tag for indicating the dataset is <cvData>

Example

subdataset

<subDataset name="Dataset1" uuid="03d50d7f-1b96-486a-ac64-7d2c6e440433">
    <queryString>
        <![CDATA[select count(*) t, shipcountry, shipcity from orders group by shipcountry, shipcity order by shipcountry, shipcity]]>
    </queryString>
    <field name="SHIPCOUNTRY" class="java.lang.String"/>
    <field name="T" class="java.lang.Long"/>
    <field name="SHIPCITY" class="java.lang.String"/>
</subDataset>

component

<cvc:customvisualization xmlns:cvc="http://www.jaspersoft.com/cvcomponent" xsi:schemaLocation="http://www.jaspersoft.com/cvcomponent http://www.jaspersoft.com/cvcomponent/component.xsd" evaluationTime="Report" onErrorType="Icon">
  <cvc:itemProperty name="script" value="d3_zoomable_circle_packing.min.js"/>
  <cvc:itemProperty name="css" value="d3_zoomable_circle_packing.css"/>
  <cvc:cvData>
    <dataset>
        <datasetRun subDataset="Dataset1" uuid="bd23d50f-2149-4985-a0ac-883505172688">
            <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
        </datasetRun>
    </dataset>
    <cvc:item>
        <cvc:itemProperty name="category">
            <valueExpression><![CDATA[$F{SHIPCOUNTRY}]]></valueExpression>
        </cvc:itemProperty>
        <cvc:itemProperty name="subcategory">
            <valueExpression><![CDATA[$F{SHIPCITY}]]></valueExpression>
        </cvc:itemProperty>
        <cvc:itemProperty name="value">
            <valueExpression><![CDATA[$F{T}]]></valueExpression>
        </cvc:itemProperty>
    </cvc:item>
  </cvc:cvData>
</cvc:customvisualization>

EDIT: As @dada67 comment it does not seem to work properly, I have also test it with sample d3_zoomable_cricle_packing.jrxml without success, this is the bug issue

The work around, create a subreport!

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
  • 2
    A datasetRun can de defined inside the jr:dataset element. But it doesn't seem to work properly; there's a bug logged at http://community.jaspersoft.com/jasperreports-library/issues/6911. Maybe there will be a fix in the next release. – dada67 Feb 23 '16 at 15:16
  • @dada67 you're right. If you know any work around please let me know. Petter, I appreciate your effort. – GeekExplorer Feb 24 '16 at 04:26
  • yeah aware of using subreport, instead i have to use sub dataset. For time being I'll accept it as answer. Please share if any other updates on this post. Thank mate :) – GeekExplorer Sep 06 '16 at 04:39