Jump to content
Changes to the Jaspersoft community edition download ×

Create table element using Json data souce


rohova.natalia
Go to solution Solved by rohova.natalia,

Recommended Posts

Hi all,

I tried to create new table element using json data source, but all my attempts are failed.

Could someone say me what is wrong, please?

I'll provide my simple source file:

{ "v1": "hi all", "v2": "hi all one more time"}[/code]

Then jrxml file:

 

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1  --><!-- 2017-01-05T18:21:20 --><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="table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3a72dcaf-8854-4198-af5e-09e6bb00c336"><property name="com.jaspersoft.studio.data.defaultdataadapter" value="SampleJson"/><style name="Table_TH" 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="Table_CH" 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="Table_TD" 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="01c37027-2dbf-4d20-b751-4aa3d410457f"><property name="com.jaspersoft.studio.data.defaultdataadapter" value="SampleJson"/><queryString language="json"><![CDATA[]]></queryString><field name="v1" class="java.lang.String"><fieldDescription><![CDATA[v1]]></fieldDescription></field><field name="v2" class="java.lang.String"><fieldDescription><![CDATA[v2]]></fieldDescription></field></subDataset><queryString language="JSON"><![CDATA[]]></queryString><field name="v1" class="java.lang.String"><fieldDescription><![CDATA[v1]]></fieldDescription></field><field name="v2" class="java.lang.String"><fieldDescription><![CDATA[v2]]></fieldDescription></field><detail><band height="264" splitType="Stretch"><componentElement><reportElement x="10" y="0" width="200" height="200" uuid="797f5893-5ed5-4786-8129-916337dff678"><property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/><property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/><property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/><property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/></reportElement><jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"><datasetRun subDataset="Dataset1" uuid="f8557661-0498-463f-8e84-c1a2f8a70e01"><dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE})]]></dataSourceExpression></datasetRun><jr:column width="100" uuid="51428778-06ea-4990-9692-1fcf9bdb7a8d"><jr:columnHeader style="Table_CH" height="30"><staticText><reportElement x="0" y="0" width="100" height="30" uuid="5eb00f89-a4f6-4018-af2e-d7fab4242008"/><text><![CDATA[v1]]></text></staticText></jr:columnHeader><jr:detailCell style="Table_TD" height="30"><textField><reportElement x="0" y="0" width="100" height="30" uuid="3ae74429-66b0-4c5e-b726-e580efb1b7bb"/><textFieldExpression><![CDATA[$F{v1}]]></textFieldExpression></textField></jr:detailCell></jr:column><jr:column width="100" uuid="62896906-50a3-4d4f-a822-1a288185c1a2"><jr:columnHeader style="Table_CH" height="30"><staticText><reportElement x="0" y="0" width="100" height="30" uuid="7eaec78c-bd4a-4137-9f93-490d1ebf2899"/><text><![CDATA[v2]]></text></staticText></jr:columnHeader><jr:detailCell style="Table_TD" height="30"><textField><reportElement x="0" y="0" width="100" height="30" uuid="2ce89834-c4f8-486b-b197-a239947de3c1"/><textFieldExpression><![CDATA[$F{v2}]]></textFieldExpression></textField></jr:detailCell></jr:column></jr:table></componentElement></band></detail></jasperReport>

 

I just wanted to run my jrxml file into html using Jaspersoft studio, but I recieved only empty page without table. No errors in logs. http://community.jaspersoft.com/sites/all/libraries/ckeditor/plugins/smiley/images/cry_smile.gif

 

Thanks in advance. 

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