Jump to content
Changes to the Jaspersoft community edition download ×

narcism

Members
  • Posts

    319
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

narcism's Achievements

Community Regular

Community Regular (8/14)

  • First Post Rare
  • Collaborator Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

40

Community Answers

  1. Try previewing with "Don't use a Data Adapter" option. Picking other data adapter will bypass the JSON_INPUT_STREAM parameter
  2. 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.
  3. 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.
  4. 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]
  5. 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.
  6. 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.
  7. Which objects can't you access? What is the desired output of your report?
  8. You could give it a try with the jrs-rest-java-client that you can find here: https://github.com/Jaspersoft/jrs-rest-java-client and some sample code in this Stackoverflow post here: https://stackoverflow.com/questions/37567237/bad-request-when-trying-to-upload-report-unit-in-jasperserver
  9. Answered here already: https://stackoverflow.com/a/64222303/5882963
  10. 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.
  11. 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]
  12. 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
  13. 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.
  14. A sample JRXML with sample JSON data might help!
  15. 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
×
×
  • Create New...