Jump to content
We've recently updated our Privacy Statement, available here ×

inanutshellus

Members
  • Posts

    12
  • 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 inanutshellus

  1. I notice the ticket has been stuck on "Feedback Requested" for a while. From whom are you expecting feedback? Other Jasper SE staff? The Author? Arbitrary netizens such as myself?
  2. The answer is, in fact, that JSON datasources do not support lists without this patch: http://community.jaspersoft.com/comment/reply/705457
  3. Looking in the source, turns out they don't support lists, so you can't do subdatasets without a flat file (which is how the subdataset is done in the Jasper Reports example). However, one of my devs has dropped a patch here: http://community.jaspersoft.com/jasperreports-library/issues/2500-0 If you have a JSON List, declare it as an InputStream and send it to your subdataset. All we need now is someone to review the patch.
  4. Given a simple JSON datasource, like so: { "Customers": [ { "ContactName": "John Doe", "Orders": [ { "OrderID": 100 }, { "OrderID": 101 } ] }, { "ContactName": "Jane Smith", "Orders": [ { "OrderID": 102 }, { "OrderID": 103 }, { "OrderID": 104 } ] } ] } I can't seem to declare the field "Orders" as a List. It blows up like so: Error filling print... Unable to get value for field 'Orders' of class 'java.util.List' net.sf.jasperreports.engine.JRException: Unable to get value for field 'Orders' of class 'java.util.List' at net.sf.jasperreports.engine.data.JsonDataSource.getFieldValue(JsonDataSource.java:233) at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:1317) [...] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: net.sf.jasperreports.engine.JRException: Field 'Orders' is of class 'java.util.List' and cannot be converted at net.sf.jasperreports.engine.data.JsonDataSource.getFieldValue(JsonDataSource.java:230) ... 13 more To reproduce it, load the following JRXML into iReport, and try to run it with the above datasource. Notice I'm not even using the Orders! <?xml version="1.0" encoding="UTF-8"?> <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="deepJsonTest" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5f9dde08-ee77-4cc0-bfe5-199306a133a9"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <queryString language="json"> <![CDATA[Customers]]> </queryString> <field name="ContactName" class="java.lang.String"> <fieldDescription><![CDATA[ContactName]]></fieldDescription> </field> <field name="Orders" class="java.util.List"> <fieldDescription><![CDATA[Orders]]></fieldDescription> </field> <detail> <band height="153" splitType="Stretch"> <textField> <reportElement uuid="923b522c-825e-4ebf-a3be-42802544f48f" x="0" y="0" width="100" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{ContactName}]]></textFieldExpression> </textField> </band> </detail> </jasperReport>
  5. Pretty spot-on blog post. JRMapCollectionDataSource seems to be exactly what I want, though I can't seem to even *declare* a Field of type java.util.List in a JSON report. Any idea what that's about?
  6. From http://stackoverflow.com/questions/4660278/subreport-overflowed-on-a-band-that-does-not-support-overflow "If you're in a Detail band, check your report's Print Order. It has to be Vertical. Horizontal Print Order reports are not allowed to overflow on Detail bands."
  7. Trying to make a subdataset work, but not sure how to communicate that to Jasper. (full disclosure: I asked this in another question here: http://jasperforge.org/node/544043)
  8. I'm looking for unit tests for the JSON Datasource and don't see any tests in the codebase... Do you guys rely on the Samples as your tests or...? Post Edited by inanutshellus at 09/20/2012 17:05
  9. Jasper Reports comes with a sample report using a JSON datasource, and the "jsonCustomerReport" shows exactly what I want it to, but it does so by requerying the entire datasource for each subreport, like so: <subreportParameter name="net.sf.jasperreports.json.source"> <subreportParameterExpression><![CDATA["data/northwind.json"]]></subreportParameterExpression> </subreportParameter> Let's say I wanted the Customer Report that looks like this: Maria Anders of Beverly Hills Order #100 Order #101 Ana Trujillo of New York City Order #102 Order #103 Order #104 But using this data as a string passed in as an InputStream: {"SomeJsonObject": { "Customers": [ { "ContactName": "Maria Anders", "CustomerID": "ALFKI", "Address": { "Street":"123 Sesame St", "City":"Beverly Hills" }, "Orders": [ { "OrderID": 100 // Other stuff snipped }, { "OrderID": 101 } ] }, { "ContactName": "Ana Trujillo", "CustomerID": "ANATR", "Address": { "Street":"456 Sesame St", "City":"New York City" }, "Orders": [ { "OrderID": 102 }, { "OrderID": 103 }, { "OrderID": 104 } ]} ]} } How would I access the Orders array? I wanted to use a SubDataSet and a List component, but I don't know what to put for the `dataSourceExpression`.
  10. To add another use case: I have several invoice layouts that have reusable components, such as a shipping label, as jasper subreports. Some of these invoices need the shipping label to be rotated 90 degrees to fit into the available space. Currently there's a fairly hefty workaround to generate the subreport as an image, rotate it in java, then cram the rotated image into the right place on the invoice. This would be an excellent feature to add in.
×
×
  • Create New...