narcism
Members-
Posts
319 -
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
Everything posted by narcism
-
Try previewing with "Don't use a Data Adapter" option. Picking other data adapter will bypass the JSON_INPUT_STREAM parameter
-
You could checkout my post on stack overflow, here: https://stackoverflow.com/a/37441567/5882963. It covers your case also. It starts with the XML solution then, towards the end, the JSON solution is presented.
-
If you search for "Array Slice" in the doc that you mentioned, you will be pointed to the specific Member type column where you'll find an example with this exact expression. For now, that is the only place where we have detailed the jsonql query language.
-
The only place you could use negative indexes is inside an "Array Slice" expression. In your case that would mean having: <field name="street1a" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="person.addresses.*[-1:].street1"/></field>[/code]
-
Not quite. The desired output is something close to what you expect your report template to produce when previewed. Based on this output I can decide if what you are trying to produce can be achieved or not in terms of JRXML syntax.
-
Please also post how you want your output to look like(you could edit the question). The Dataset and Query Dialog may not offer much help in your case, as you have varying JSON keys.
-
Which objects can't you access? What is the desired output of your report?
-
Answered here already: https://stackoverflow.com/a/64222303/5882963
-
The table interactivity does not work for columns with detail cells that have complex textField expressions. For columns that format dates/numbers you could move the pattern at the textField level and choose Blank When NULL in the textField properties. This way you could only reference the textField in the expression and have the interactivity on for that column.
-
JSON ARRAY JSON Data source displaying null values
narcism replied to raval.chintan's topic in Products
With JSON you need to change the field expression from "[0]" to ".", like so: <field name="FirmReferenceNumber" class="java.lang.String"> <property name="net.sf.jasperreports.json.field.expression" value="."/> <fieldDescription><![CDATA[FirmReferenceNumber]]></fieldDescription></field>[/code] -
jaspersoft studio 6.12 JSONQL JSONArray issue with charcter -
narcism replied to raval.chintan's topic in Products
This is not a bug. The "AB-CDEF" in "DataItem.AB-CDEF" is not a valid object key in JSONQL, so it needs to be wrapped in quotes and square brackets: <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("DataItem["AB-CDEF"].GroupData.OGF.FRN")]]></dataSourceExpression>[/code]There are more details in the JSONQL description page here: http://jasperreports.sourceforge.net/sample.reference/jsonqldatasource/index.html#jsonql -
You need to set the query language to JSONQL/jsonql for "..name" or "$..name" to work. This also needs to be matched with the proper field expression like so: <queryString language="jsonql"> <![CDATA[..name]]></queryString><field name="name" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="[0]"/> <fieldDescription><![CDATA[The name]]></fieldDescription></field>[/code]This is a special case where the query returns only the leaf nodes of the JSON tree, hence the weird expression. However, if you had "..customer" as your main query, you could use <property name="net.sf.jasperreports.jsonql.field.expression" value="name"/> for your field.
-
A sample JRXML with sample JSON data might help!
-
I'm posting only the relevant part, the query and the field mappings: <queryString language="jsonql"> <![CDATA[list.*]]></queryString><field name="keyA" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="keyA"/> <fieldDescription><![CDATA[keyA]]></fieldDescription></field><field name="keyB" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="keyB"/> <fieldDescription><![CDATA[keyB]]></fieldDescription></field><field name="keyC" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="keyC"/> <fieldDescription><![CDATA[keyC]]></fieldDescription></field><field name="Title" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="^{2}.title"/> <fieldDescription><![CDATA[Title]]></fieldDescription></field><field name="Author" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="^{2}.AUTHOR"/> <fieldDescription><![CDATA[Author]]></fieldDescription></field><field name="Date" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="^{2}.DATE"/> <fieldDescription><![CDATA[Date]]></fieldDescription></field>[/code]Some notes: 1. If you manually change the query language, from JSON to JSONQL, you also need to adjust the field-level properties to use the proper name: net.sf.jasperreports.jsonql.field.expression 2. JSON/JSONQL expressions are case sensitive 3. The JSONQL expression "^{2}.title" implies going up 2 levels from whatever your main query item points to, then select "title" 4. If your JSON data is part of a bigger JSON tree, then you need to adjust your main query expression from "list.*" to "..list.*" which will look for the "list" key anywhere in the JSON tree
-
If you are trying to filter inside a field expression, it is not possible. Filtering with values from the same JSON tree it is also not supported. In your case you could filter in a subDataSource that you pass to a list like so: <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.12.2.final using JasperReports Library version 6.12.2-75c5e90a222ab406e416cbf590a5397028a52de3 --><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="Report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="119c58db-8ae4-4c92-8cd2-16ea09ccb158"> <subDataset name="IndividualsDS" uuid="639a0f17-766f-42f5-bdfe-4157c94becfe"> <field name="givenName" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="givenName"/> <fieldDescription><![CDATA[givenName]]></fieldDescription> </field> </subDataset> <queryString language="jsonql"> <![CDATA[customer]]> </queryString> <field name="customerId" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="id"/> <fieldDescription><![CDATA[id]]></fieldDescription> </field> <field name="customerName" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="name"/> <fieldDescription><![CDATA[name]]></fieldDescription> </field> <field name="customerEngagedPartyId" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="engagedParty.id"/> <fieldDescription><![CDATA[engagedPartyId]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <columnHeader> <band height="30" splitType="Stretch"> <staticText> <reportElement x="0" y="0" width="180" height="30" uuid="81411315-5690-4f34-a559-3f792e0aad89"/> <text><![CDATA[Customer Id]]></text> </staticText> <staticText> <reportElement x="180" y="0" width="185" height="30" uuid="1251081f-19ac-46cd-a22e-71159f586b76"/> <text><![CDATA[Customer Name]]></text> </staticText> <staticText> <reportElement x="365" y="0" width="185" height="30" uuid="b1e0c3a6-a04c-4bdd-99f3-f1a1e612a62c"/> <text><![CDATA[individual Name]]></text> </staticText> </band> </columnHeader> <detail> <band height="30" splitType="Stretch"> <textField> <reportElement x="0" y="0" width="180" height="30" uuid="f6957d1f-1d6b-4855-8ced-af36ea456ff0"/> <textFieldExpression><![CDATA[$F{customerId}]]></textFieldExpression> </textField> <textField> <reportElement x="180" y="0" width="185" height="30" uuid="2d38c046-a00f-40a0-8750-fd5c0d59018d"/> <textFieldExpression><![CDATA[$F{customerName}]]></textFieldExpression> </textField> <componentElement> <reportElement x="365" y="0" width="185" height="30" uuid="9e0fdaa7-3cef-4e9c-97a7-715bf5ef499e"/> <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical"> <datasetRun subDataset="IndividualsDS" uuid="72b178d8-0026-4847-9760-ce82b0256e42"> <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("^.individuals.*(id == "" + $F{customerEngagedPartyId} + "")")]]></dataSourceExpression> </datasetRun> <jr:listContents height="30" width="185"> <textField> <reportElement x="0" y="0" width="185" height="30" uuid="ddd6c429-74ee-41ea-9914-f9ff4c44a8f3"/> <textFieldExpression><![CDATA[$F{givenName}]]></textFieldExpression> </textField> </jr:listContents> </jr:list> </componentElement> </band> </detail></jasperReport>[/code]
- 1 reply
-
- json
- json datasource
-
(and 2 more)
Tagged with:
-
How to toggle Report Pagination with visualize.js?
narcism replied to Andreas Kügler's topic in Developers and API
In this case, the ignorePagination property is read-only, so once set, it cannot be changed unless you completely rerun the report. I've altered your fiddle here: jsfiddle. In essence, I destroy the previous instance and then reset the report reference to the new one with the ignorePagination according to the checkbox. -
Pass CSV DataSource from java program to Report's Tables
narcism replied to emanuele.a89's topic in Products
Same answer as posted here: https://stackoverflow.com/questions/60167856/pass-csv-datasource-from-java-program-to-reports-tables/60185299#60185299 You are reusing the same data source for filling the main dataset and the tables: JRCsvDataSource ds = new JRCsvDataSource(inp);..._parameters.put("DS", ds);jasperPrint = JasperFillManager.fillReport(_jasperReport, _parameters, ds); This has unpredictable results because of the multiple consumers for the same data source. If you have control over the InputStream source like the path to the file you could pass that as a parameter and construct a new instance of JRCsvDataSource for each table that needs it.- 2 replies
-
- parameters
- dataset
-
(and 2 more)
Tagged with:
-
What exactly does your desired output look like?
-
If you are able to switch to JSONQL language, you could use a query like: *(id == "bugcorrection") The original JSON language is very limited in terms of tree traversal and is meant to be replaced by JSONQL.
- 3 replies
-
- json data adapter
- json datasource
-
(and 1 more)
Tagged with:
-
nested array of bytes inside json which is a datasource jasper studio
narcism replied to pawel.kuzma's topic in Products
Same question here: https://stackoverflow.com/questions/58977354/nested-array-of-bytes-inside-json-which-is-a-datasource-jasper-studio My comment applies here also.- 2 replies
-
- json datasource
- image
-
(and 1 more)
Tagged with:
-
The installer files are hosted on sourceforge: https://sourceforge.net/projects/jasperstudio/files/ and linked here.
-
JSONQL: Retrieve values from array wthout key/index
narcism replied to shavaughn70's topic in Products
What does your JRXML look like? -
Report with Json DataSource return node field
narcism replied to ricardo.a.blanco's topic in Products
You have entered a json query(slccReponseBesoins) in the text area below the 'Read Fields' button. You need to clear it up and press 'Read Fields' again.'- 4 replies
-
- datasource
- json
-
(and 1 more)
Tagged with:
-
Report with Json DataSource return node field
narcism replied to ricardo.a.blanco's topic in Products
What does your JSON data look like?- 4 replies
-
- datasource
- json
-
(and 1 more)
Tagged with: