bluezebra38799 Posted January 15, 2016 Posted January 15, 2016 help me please! My english is not good.I try print json inputsteam with crosstab but crosstab don't split data.so I try other way such as convert type, change datatype, split manual but don't workwithSubDataset_Q.jrxml<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 --><!-- 2016-01-15T14:59:28 --><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="withSubDataset" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5fd175e1-3d6e-46f3-8f8c-c9b6b3fb6f33"> <style name="Crosstab_CH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Crosstab_CG" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Crosstab_CT" mode="Opaque" backcolor="#005FB3"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Crosstab_CD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="Dataset1" uuid="e80c721d-803e-45e0-beb7-92b9d6afff53"> <property name="net.sf.jasperreports.json.source" value="/data/rawData.json"/> <queryString language="json"> <![CDATA[]]> </queryString> <field name="word" class="java.lang.String"> <fieldDescription> <![CDATA[word]]> </fieldDescription> </field> <field name="totalCount" class="java.lang.String"> <fieldDescription> <![CDATA[totalCount]]> </fieldDescription> </field> <field name="source" class="java.lang.String"> <fieldDescription> <![CDATA[data.source]]> </fieldDescription> </field> <field name="count" class="java.lang.String"> <fieldDescription> <![CDATA[data.count]]> </fieldDescription> </field> </subDataset> <queryString language="json"> <![CDATA[]]> </queryString> <detail> <band height="219" splitType="Stretch"> <crosstab> <reportElement x="0" y="0" width="800" height="40" uuid="7212a6c5-a28e-4c3c-bdff-2facdad3ab7c"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/> </reportElement> <crosstabDataset> <dataset> <datasetRun subDataset="Dataset1" uuid="d32ed24a-eba3-42b4-a7c2-559712c1fa00"> <datasetParameter name="JSON_INPUT_STREAM"> <datasetParameterExpression> <![CDATA[$P{JSON_INPUT_STREAM}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="net.sf.jasperreports.json.source"> <datasetParameterExpression> <![CDATA[$P{net.sf.jasperreports.json.source}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="net.sf.jasperreports.json.sources"> <datasetParameterExpression> <![CDATA[$P{net.sf.jasperreports.json.sources}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="net.sf.jasperreports.json.date.pattern"> <datasetParameterExpression> <![CDATA[$P{net.sf.jasperreports.json.date.pattern}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="net.sf.jasperreports.json.number.pattern"> <datasetParameterExpression> <![CDATA[$P{net.sf.jasperreports.json.number.pattern}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="JSON_LOCALE"> <datasetParameterExpression> <![CDATA[$P{JSON_LOCALE}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="net.sf.jasperreports.json.locale.code"> <datasetParameterExpression> <![CDATA[$P{net.sf.jasperreports.json.locale.code}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="JSON_TIME_ZONE"> <datasetParameterExpression> <![CDATA[$P{JSON_TIME_ZONE}]]> </datasetParameterExpression> </datasetParameter> <datasetParameter name="net.sf.jasperreports.json.timezone.id"> <datasetParameterExpression> <![CDATA[$P{net.sf.jasperreports.json.timezone.id}]]> </datasetParameterExpression> </datasetParameter> </datasetRun> </dataset> </crosstabDataset> <rowGroup name="word1" width="80"> <bucket class="java.lang.String"> <bucketExpression> <![CDATA[$F{word}]]> </bucketExpression> </bucket> <crosstabRowHeader> <cellContents mode="Opaque" style="Crosstab_CH"> <textField> <reportElement x="0" y="0" width="80" height="20" uuid="6809ce4b-dfb4-4dd1-a849-461b797c1f9c"/> <textFieldExpression> <![CDATA[$V{word1}]]> </textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents/> </crosstabTotalRowHeader> </rowGroup> <columnGroup name="source1" height="20"> <bucket class="java.lang.String"> <bucketExpression> <![CDATA[$F{source}]]> </bucketExpression> </bucket> <crosstabColumnHeader> <cellContents mode="Opaque" style="Crosstab_CH"> <textField> <reportElement x="0" y="0" width="320" height="20" uuid="719eb0b4-da94-460f-a452-8f270fe5be27"/> <textFieldExpression> <![CDATA[$V{source1}]]> </textFieldExpression> </textField> </cellContents> </crosstabColumnHeader> <crosstabTotalColumnHeader> <cellContents/> </crosstabTotalColumnHeader> </columnGroup> <measure name="count_MEASURE1" class="java.lang.String"> <measureExpression> <![CDATA[$F{count}]]> </measureExpression> </measure> <crosstabCell width="320" height="20"> <cellContents mode="Opaque" style="Crosstab_CD"> <textField> <reportElement x="0" y="0" width="320" height="20" uuid="a8b9cf16-56e4-47dd-bfc6-d2bf1b7024ff"/> <textFieldExpression> <![CDATA[$V{count_MEASURE1}]]> </textFieldExpression> </textField> </cellContents> </crosstabCell> </crosstab> </band> </detail></jasperReport>[/code]rawData.json[ { "word" : "one", "totalCount": 258, "data" : [ { "source" : "Twitter", "count" : 258 }, { "source" : "Facebook","count" : 0 }, { "source" : "Pantip", "count" : 0 }, { "source" : "Jive", "count" : 0 } ] }, { "word" : "two", "totalCount": 6, "data" : [ { "source" : "Twitter", "count" : 6 }, { "source" : "Facebook","count" : 0 }, { "source" : "Pantip", "count" : 0 }, { "source" : "Jive", "count" : 0 } ] }, { "word" : "three", "totalCount": 100, "data" : [ { "source" : "Twitter", "count" : 100 }, { "source" : "Facebook","count" : 0 }, { "source" : "Pantip", "count" : 0 }, { "source" : "Jive", "count" : 0 } ] }][/code]Result:
2340patel Posted April 4, 2018 Posted April 4, 2018 Hi did you get issue solved. we are facing same error. Can you pls let us know on same. anjana.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now