hihaji4222 Posted October 24, 2020 Share Posted October 24, 2020 Estoy preparando un informe en JasperSoft Studio usando un JSON como origen de datos, que contiene una matriz al final de la última clave del objeto, con las claves del JSONObject, relleno la banda de detalles del informe y con la otra matriz, relleno una tabla en la banda Resumen, en JasperSoft Studio genera correctamente el informe genera el informe , al generar el informe en código Java utilizando Java 8 utilizando NetBeans como entorno IDE, el informe sólo genera una sola fila con valores Null y no muestra la tabla, adjunto las imágenes y el código Java.El JSON contiene la siguiente estructura:{ "0": { "a": "datos1", "b": "M-datos2", "c": "datos3", "d": "datos4", "e": "datos5", "f": "datos6", "g": "2", "h": "datos7", "i": "$5,000.00", "j": "$0.00", "k": "$0.00", "l": "5000.00", "m": "datos8" }, "1": { "a": "datos1", "b": "M-datos2", "c": "datos3", "d": "datos4", "e": "datos5", "f": "datos6", "g": "2", "h": "datos7", "i": "$5,000.00", "j": "$0.00", "k": "$0.00", "l": "5000.00", "m": "datos8" }, "2": { "a": "datos1", "b": "M-datos2", "c": "datos3", "d": "datos4", "e": "datos5", "f": "datos6", "g": "2", "h": "datos7", "i": "$5,000.00", "j": "$0.00", "k": "$0.00", "l": "5000.00", "m": "datos8" }, "3": { "a": "datos1", "b": "M-datos2", "c": "datos3", "d": "datos4", "e": "datos5", "f": "datos6", "g": "2", "h": "datos7", "i": "$5,000.00", "j": "$0.00", "k": "$0.00", "l": "5000.00", "m": "datos8" }, "4": { "a": "datos1", "b": "M-datos2", "c": "datos3", "d": "datos4", "e": "datos5", "f": "datos6", "g": "2", "h": "datos7", "i": "$5,000.00", "j": "$0.00", "k": "$0.00", "l": "5000.00", "m": "datos8", "sub-totales": [ { "n-mes": "10", "sub-total": "13200.00" } ] }}JasperSoft Studio genera correctamente la siguiente imagen en su versión 6.15.0/sites/default/files/user_uploads/hihaji4222/captura_de_pantalla_2020-10-24_114044.pngAnnex image of the report generated in Java 8 using NetBeans 8.2, where it only shows null values and does not show the table, using the same JSON data source Annex Java code using to generate the report:InputStream is; is = getClass().getResourceAsStream("/REPORTS/report.jasper"); Map parameters = new HashMap(); parameters.put("IMAGE", IMAGE); parameters.put("BACKG", BACKG); ByteArrayInputStream jsonDataStream = new ByteArrayInputStream(JSON.toString().getBytes()); JRDataSource ds = new JsonQLDataSource(jsonDataStream); JasperReport jr = (JasperReport) JRLoader.loadObject(is); JasperPrint jp = JasperFillManager.fillReport(jr, parameters, ds); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true);I have updated the Java libraries to their latest version but it still doesn't work, I would appreciate your help Link to comment Share on other sites More sharing options...
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