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

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

  1. What exactly do you want to print out? You need to describe the desired output and post what you have so far.
  2. 1. Make sure you have a Data Adapter XML file in your workspace. You can export the one from Repository Explorer if you chose that path. Let's assume you named it JSON_DA.xml and placed it in the same folder with your report. 2. Link it to the report either: - by manually setting this property: - or by setting the Default Data Adapter in the Report Properties tab to point to your XML file 3. JasperSoft Studio should pick it up automatically this way when publishing to server
  3. Unfortunately there's no JSONQL operation to pick up an object key(s) right now. A future enhancement may address this. You could get everything else just by modifying the JsonQLDatasource query: new net.sf.jasperreports.engine.data.JsonQLDataSource(new ByteArrayInputStream($F{Values}.getBytes("UTF-8")), ".*")
  4. You need to convert the String value to a JsonQLDataSource like so: <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 --><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="4c53fb8c-7bb8-4faa-a219-05712dd54a30"> <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="TableDataset" uuid="70d9d3c4-af50-48fc-a8a9-205697b62f0c"> <field name="GP" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="GP"/> </field> <field name="Er" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="Er"/> </field> <field name="Ee" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="Ee"/> </field> <field name="GP-YTD" class="java.lang.String"> <propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["["GP-YTD"]"]]></propertyExpression> </field> </subDataset> <queryString language="jsonql"> <![CDATA[employee..state.N]]> </queryString> <field name="Values" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="Values"/> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <staticText> <reportElement x="130" y="10" width="300" height="30" uuid="bd4b0bab-1996-4952-884b-5e508abc8af3"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="16"/> </textElement> <text><![CDATA[JSON String to JsonQLDataSource Example]]></text> </staticText> </band> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="30" splitType="Stretch"/> </columnHeader> <detail> <band height="64" splitType="Stretch"> <componentElement> <reportElement x="0" y="0" width="200" height="64" uuid="d521af5c-22ab-4e28-a8ef-7bbeedd122ef"> <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="TableDataset" uuid="318415a6-a046-4886-b04a-f13c3e9bf6f0"> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JsonQLDataSource(new ByteArrayInputStream($F{Values}.getBytes("UTF-8")), "A")]]></dataSourceExpression> </datasetRun> <jr:column width="50" uuid="21fbea93-d2e3-4572-b730-2dfba3eab448"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="50" height="30" uuid="b54c30af-fb8f-42cc-81d3-a7423ca9b329"/> <text><![CDATA[GP]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="50" height="30" uuid="6646c3f5-5074-4e24-85ae-9b0b39d04a30"/> <textFieldExpression><![CDATA[$F{GP}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="50" uuid="996ba5ec-f669-42b5-9bdb-dae2605e4dee"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="50" height="30" uuid="e2093fd3-158b-45e2-ac59-44c79b2a2ba2"/> <text><![CDATA[Er]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="50" height="30" uuid="133cdcd6-1b61-4d47-816c-1e68a9aa71a8"/> <textFieldExpression><![CDATA[$F{Er}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="50" uuid="1e059e33-1821-49bc-b4a9-7f08edcbd979"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="50" height="30" uuid="7338cd27-5d1b-4a79-a64a-eea0878565f1"/> <text><![CDATA[Ee]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="50" height="30" uuid="c9352309-2ded-4e3a-9e4d-f158e2af1b8e"/> <textFieldExpression><![CDATA[$F{Ee}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="50" uuid="e63302fb-4fbb-4685-a0ca-3a6933aa5b3a"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="50" height="30" uuid="fa704777-82d1-46bd-8dfe-b33b50ed36f6"/> <text><![CDATA[GP-YTD]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="50" height="30" uuid="8ffd553e-3e7b-4d45-a932-8bf5a99d7a28"/> <textFieldExpression><![CDATA[$F{GP-YTD}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail></jasperReport>[/code]
  5. Starting with TIBCO Jaspersoft® Studio v6.4.0 you could safely use the JSON Data Adapter to achieve similar functionality that you get with Web Service Data Adapter. The main steps are: Create the JSON Data Adapter: Either create one, in the Repository Explorer view(Clik on the first icon in the top-right corner), or, directly in one of your project's folder(Right Click on the folder -> New -> Data Adapter). In the Data Adapter Wizard, you choose the JSON File Data Adapter. Give it a name and paste your JSON API URL in the File/URL input field. Once you have pasted/written the URL the File button will turn into an Options button where you could refine your API call(authentication, HTTP verbs and headers, URL parameters). Check the "Use the report JSON expression when filling the report" to have more flexibility when writing the JSONQL query. Create the Report without specifying the newly created adapter. Open the Dataset and Query Dialog(Click the first icon in the top-right corner of your Design tab): Pick your JSON Data Adapter in the top-left corner of the Dialog. Choose jsonql as the language as the JSON one is too limited in functionality. Write a jsqonql query as explained in the next step. Write a query in the dedicated input field. There are more options when doing this and some depend on the structure of your JSON response from the URL call: If the "tgaCode" is unique across the whole JSON, and you want only that as a field, you could simply write this query: "..tgaCode" (without quotes). This means select the tgaCode key from everywhere. Then click the Read Fields button and notice only one field with the "[0]" expression. You could rename the field name at this point to be more appropriate. If the "tgaCode" is not unique across the entire JSON you could write: "qualificationDtoMap..tgaCode" to give it a context to start from. If you want other keys besides tgaCode you could write: "..[id, tgaCode, tgaTitle]" or "qualificationDtoMap..[id, tgaCode, tgaTitle]". These are just some of the options to write a query for this specific case. If you want to read more about JSONQL you could check out http://jasperreports.sourceforge.net/sample.reference/jsonqldatasource/index.html#jsonql Note:All the options in the Data Adapter can be dinamically set through the means of properties set to report parameters. For instance, if you need to customize the URL endpoint to have it resemble https://jsonplaceholder.typicode.com/todos/{id} you could: leave it empty in the adapter add these report-level parameters: <parameter name="todoId" class="java.lang.Integer"> <defaultValueExpression><![CDATA[7]]></defaultValueExpression></parameter><parameter name="theUrl" class="java.lang.String"> <property name="net.sf.jasperreports.http.data.url"/> <defaultValueExpression><![CDATA["https://jsonplaceholder.typicode.com/todos/" + $P{todoId}]]></defaultValueExpression></parameter>[/code]The other parameters that could be set this way could be found here:
  6. I am not sure about the Web Service Data Source's case since it is not officially supported by TIBCO, as stated in the link you provided. The reason I asked about you being tied to a specific version is because starting with Jaspersoft Studio v6.4.0 you should be able to achieve similar functionality with the built-in mechanisms that reside inside the JasperReports Library on which Studio relies. It is about the JSON Data Adapter(that supports URL parameters, custom headers, HTTP POST/GET/PUT) which used in conjuntion with JSONQL could easily solve your problem. I could only try and guide you towards that solution if that is fine with you.
  7. Are you tied to a specific Jaspersoft Studio version?
  8. What is your report datasource configuration in Studio?
  9. You can add debugging capabilities to visualize via URL parameters. Use this instead of your initial URL: http://localhost:8080/jasperserver-pro/client/visualize.js?logEnabled=true&logLevel=debug and check your browser's console for any meaningful output
  10. A master report usually picks up compiled subreports (*.jasper files). Try recompiling each modified subreport. You could do that: either manuallyor by selecting Project > Build Automatically in the Jaspersoft Studio's menu. In this case you shoud also perform a Project > Clean operation to make sure everything gets recompiled
  11. This post has a complete working sample similar to your case: https://community.jaspersoft.com/questions/1047486/how-fill-table-subdataset-json
  12. Please post some sample JRXML and the Studio version in order to reproduce your issue.
  13. In the JSON file you have dates in String format. If you want to treat them as dates in your report, you need to: declare the fields with the appropriate Date type(e.g. java.util.Date, java.sql.Date, etc.)specify the Date pattern in the Data Adapter file/dialog for proper conversion from String to your type. Your pattern may be something like: yyyy-MM-ddset the desired pattern at textField level
  14. Starting with Jaspersoft Studio 6.4.0 and JasperReports Server 6.4.0 you can set URL parameters in the JSON Data Adapter or by setting specific properties at the parameter level. More info in the HTTP Data Adapter Sample: http://jasperreports.sourceforge.net/sample.reference/httpdataadapter/index.html
  15. You should not use a table for the task attributes. Instead, in your main report, you could: Remove the table and both subDatasetsUse "tasks" as query string instead of emptySet the task attributes as fieldsIn detail band create textFields for the above fieldsKeep the subreport in detail band but with .subDataSource("logs") instead of .subDataSource("tasks.logs")This way you iterate directly over tasks in your main report, and wherever you have logs, the subreport will display them. There is even a more compact solution for this based on JSONQL, but it involves upgrading JaspersoftStudio to at least 6.4.0
  16. You need to edit this post with actual data and desired output. Your image URL is not accessible.
  17. It seems that this has been asked before: https://community.jaspersoft.com/questions/849516/passing-collection-jasper-server-restv2-api
  18. In a very basic way you can achieve what you want like so: <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1 --> <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="JSONQL_no_table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="98c9b141-c0bd-4f9f-a8d6-b9b3caaf615d"> <queryString language="jsonql"> <![CDATA[data.programmes.*]]> </queryString> <field name="JobRole" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="^^jobRole"/> </field> <field name="Programe" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="programe"/> </field> <field name="Provider" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="provider"/> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="30" splitType="Stretch"> <staticText> <reportElement mode="Opaque" x="0" y="0" width="185" height="30" backcolor="#D2FAF6" uuid="d82ddd57-6ddd-470f-b75a-3c7e02701dc7"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="90cf53a0-a0d3-4bfe-bf2b-bd79c533db73"/> </reportElement> <text><![CDATA[JobRole]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="185" y="0" width="185" height="30" backcolor="#D2FAF6" uuid="a7760d02-ea94-446c-a42a-49da6f2446e5"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="444f9be5-2968-463d-b008-68d4fb3d5317"/> </reportElement> <text><![CDATA[Programe]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="370" y="0" width="185" height="30" backcolor="#D2FAF6" uuid="0064f2ea-7529-4772-a3e7-83258c146ae9"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="c06960f0-e4bf-481e-9050-bdacd95bf764"/> </reportElement> <text><![CDATA[Provider]]></text> </staticText> </band> </columnHeader> <detail> <band height="30" splitType="Stretch"> <textField> <reportElement x="185" y="0" width="185" height="30" uuid="f9705c9f-75c8-476e-aae6-66655b790479"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="444f9be5-2968-463d-b008-68d4fb3d5317"/> </reportElement> <textFieldExpression><![CDATA[$F{Programe}]]></textFieldExpression> </textField> <textField> <reportElement x="370" y="0" width="185" height="30" uuid="37ca4922-b0fc-4588-8905-997e4fae4471"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="c06960f0-e4bf-481e-9050-bdacd95bf764"/> </reportElement> <textFieldExpression><![CDATA[$F{Provider}]]></textFieldExpression> </textField> <textField> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="185" height="30" uuid="b2e61cda-d53c-4d7a-a123-3233548528a1"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="90cf53a0-a0d3-4bfe-bf2b-bd79c533db73"/> </reportElement> <textFieldExpression><![CDATA[$F{JobRole}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="54" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary> </jasperReport>
  19. You only need to subDatasource inside your table's datasetRun. I'm posting only the relevant changes: 1. The subDataset definition: <subDataset name="proofs" whenResourceMissingType="Key" uuid="4563e834-a9e5-43b5-9f0a-824948c73c73"> <field name="proofType" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="proofType"/> </field> <field name="proofName" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="proofName"/> </field> <field name="proofFile" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="proofFile"/> </field> </subDataset> 2. The table datasetRun definition: <datasetRun subDataset="proofs" uuid="75af8bcf-1dd6-4a94-9e96-0d976350d14e"> <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("proofs.*")]]></dataSourceExpression> </datasetRun>
  20. You need to: 1. Delay the jqxMenu creation until all the submenu items are in the DOM 2. Store the item.uri in a different location Something like so: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <title>Reporting Menu - Vertical Menu Sample</title> <script type='text/javascript' src="../resources/scripts/jquery-3.3.1.js"></script> <link rel="stylesheet" href="../resources/jqwidgets/styles/jqx.base.css" type="text/css"/> <script type="text/javascript" src="../resources/jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../resources/jqwidgets/jqxmenu.js"></script> <script type='text/javascript' src="http://auditpreprod:8082/jasperserver-pro/client/visualize.js?logEnabled..."></script> </head> <body> <div id='content'> <div id='jqxWidget' style="display: none;"> <div id='jqxMenu' class="jqxMenu"> <ul> <li id ='mainmenuid'>Reporting </li> <li id ='requestmenuid'>Request Managments <ul id ='ulrequestmenuid'></ul> </li> </ul> </div> </div> </div> <div id="placeholder"></div> <script> visualize({ auth: { name: "superuser", password: "superuser" } }, function (v) { v.resourcesSearch({ folderUri: "/public", recursive: true, types: ["reportUnit","dashboard"], success: renderResults, error: handleError }); // utility function function renderResults(results) { var $submenu = $("#ulrequestmenuid"); $submenu.html(""); $.each(results, function (i, item) { $submenu.append('<li><span data-uri="' + item.uri + '">'+ item.label+'</span></li>'); }); $("#jqxMenu").jqxMenu({ width: '300', mode: 'vertical'}); $("#jqxWidget").show(); } $("#ulrequestmenuid").on("click", "span", function(evt) { var resourceUri = $(this).data("uri"); v("#placeholder").report({ resource: resourceUri, error:handleError }); }); function handleError(err){ alert(err.message); }; }); </script> </body> </html>
×
×
  • Create New...