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

Dhiraj Pahlani

Jaspersoft Staff
  • Posts

    68
  • 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 Dhiraj Pahlani

  1. Hi, Yes, you can upload report with its subreport(s) using REST API. Refer below Wiki article, which I have created for this requirement: https://community.jaspersoft.com/wiki/uploading-reports-subreports-using-rest-api
  2. Hi, Yes, you can upload report with its subreport(s) using REST API. Refer below Wiki article, which I have created for this requirement: https://community.jaspersoft.com/wiki/uploading-reports-subreports-using-rest-api
  3. Uploading Reports With Subreports Using REST API Requirement: To upload reports having subreports using REST API. Solution: A report unit contains mostly references to the files that make up a report within the server, like input controls, subreports, etc. So, a report unit is a composite resource that may contain other local resources. In this case, the URIs that it references include a URI in the following format: <reportUnitURI>_files/<localResourceID> So for example, say, we have a main .jrxml report - testSubreport.jrxml and this main .jrxml report has its one subreport - test.jasper and both these reports are created locally in Studio, and we do not have the subreport already uploaded to the JasperReports Server yet and we will publish both the main .jrxml report and its subreport using REST API. In this case, before we perform the upload with REST API, we need to provide the subreportExpression inside the source of our main .jrxml report in the above format i.e <reportUnitURI>_files/<localResourceID> So from the above example, this format would look like below, considering we are uploading the report to our JasperReports Server repository under /public/Samples/Reports path: /public/Samples/Reports/testSubreport_files/test And hence, the subreportExpression inside the source of our main .jrxml report would be like: <subreport> … <subreportExpression><![CDATA["/public/Samples/Reports/testSubreport_files/test"]]></subreportExpression> </subreport> With the above information, we are now ready to proceed with the upload of our main and subreport using REST API. We will now use a POST rest_v2/resources service and send a complete body descriptor containing our main and subreport in base64EncodedContent. POST http://<host>:<port>/jasperserver[-pro]/rest_v2/resources/path/to/folder Content-Type: application/repository.<resourceType>+json In our example, the request and the content type would look like: POST http://localhost:8080/jasperserver-pro/rest_v2/resources/public/Samples/Reports Content-Type: application/repository.reportUnit+json For more information on creating a resource using REST API, see “Creating a Resource” section from our REST API guide: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v790/resources-service#:~:text=in%20the%20repository.-,Creating%20a%20Resource,-The%20POST%20and And general structure of the body descriptor should be like below: { "uri": "{resourceUri}", "label": "Sample Label", "permissionMask": "0", "version": 0, "dataSource": { "dataSourceReference": { "uri": "{dataSourceUri}" } }, "jrxml": { "jrxmlFile": { "label": "Main jrxml", "type": "jrxml", "content": "{base64encodedContent}" } }, "inputControls": [ { "inputControlReference": { "uri": "{inputControlUri}" } }, ... ], "resources": { "resource": [ { "name": "{resourceName}", "file" : { "fileResource": { "label": "{label}", "type": "jrxml", "content": "{base64EncodedContent}" } } }, { "name": "{resourceName}", "file": { "fileReference": { "uri": "{uri}" } } }, ... ] } } The above descriptor is for a report unit. For more information on other resources’ descriptors, see “Resource Descriptors” section from our REST API guide: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v790/resource-descriptors Thus, following the above we can publish a report with its subreport(s) using REST API. A test.json file can be found in the attachments section of this article, which can be run using a POST request in a REST-tool, like Postman. The report, once uploaded, can be run using the sample Foodmart DB on JasperReports Server UI. POST http://localhost:8080/jasperserver-pro/rest_v2/resources/public/Samples/Reports Header: Content-Type: application/repository.reportUnit+json test.json
  4. Y-Axis Number Format Requirement: For your HTML5 Line chart or a Time Series chart, you wish to display the Y-Axis number format in thousands instead of ...k (e.g from 15k to 15000). Solution: Follow below steps to achieve the requirement: 1. Open the report in Jaspersoft Studio. 2. Select HTML5 Chart from the outline view. Right-click and select 'Edit Chart properties'. 3. HTML5 Chart Edit Dialog will appear. Click on 'Chart Formatting' tab and then click on 'Show Advanced Properties'. 4. Expand 'yAxis' and then expand 'labels'. Now, locate 'format'. Double-click it and enter {value} in the field (by default it is {value} but double-click and enter {value} to set it as Current Value). 5. Click Ok. Save the report and then preview it. A sample .jrxml report and screensot of the preview window from Jaspersoft Studio can be found in the attachments section of this article and the report can be run using sample Foodmart DB y-axis_number_format.jrxml
  5. Requirement:How to display all 12 months on X-Axis of a Time Series chart even if the data for few months is 0? Solution:To achieve this requirement, we will need to use xAxis.units chart property: Open your .jrxml report in Jaspersoft Studio. Select the Time Series chart, right-click it and then select 'Edit Chart properties'. The Chart Edit dialog box will appear. Select 'Chart Formatting' tab and then click on 'Show Advanced Properties'. Now expand 'xAxis' and locate 'units' property. Double-click on 'units' and add below expression to this property: new Object[]{new Object[]{"month", new Object[]{1}}} Click on 'OK' twice. Save the report and then preview it. A sample .jrxml report can be found in the attachments section of this article. The report can be run with Foodmart DB and below parameter values maybe used to run the report: StoreId = 1 AccountId = 4100 StartExpDate = Dec 31, 2017 EndExpDate = Dec 31, 2018When the report is ran with above parameters, each value for the month category from Jan to Dec will have value as 0 for the measure and yet each month would be displayed on the X-Axis even when the measure value for all of them is 0. monthdata.jrxml
  6. Check below Wiki article and make sure you have overflowToDisk="false" defined under ehcache.xml (<jasperserver-pro>/WEB-INF) file.https://community.jaspersoft.com/wiki/ehcachestorediskdiskstoragefactory-error-disk-write-profileattributecachekey-failed
  7. Problem:You've upgraded your TIBCO JasperReports® Server (which uses SSL and a proxy server URL) and after the upgrade when accessing the homepage of the JasperReports Server, the homepage contents (like, Ad Hoc Views, Reports, Dashboards, Domains, etc.) are not visible and the homepage seen is blank. Cause:This may happen because the JasperReports Server is not configured to use only SSL and/or the configurations for using the proxies are not made correctly for the current version of JasperReports® Server. Solution:Try to configure your JasperReports Server to use proxy: Open the js.config.properties (jasperserver-pro/WEB-INF)file in an editor.Search for the deploy.base.url property and provide your proxy server URL as the value to this property, like: deploy.base.url=https://bi.example.com/jasperserver-proSimilarly, search for the report.scheduler.web.deployment.uri property under this same file and provide your proxy server URL as the value to this property, like: report.scheduler.web.deployment.uri=https://bi.example.com/jasperserver-proSave the file.Restart the application server for the changes to reflect.For more details on the configurations for using proxies, refer the below documentation link: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-administrator-guide/v750/configuration-using-proxies For JasperReports Server v7.9.0, you may refer the below documentation link to know about the configurations for using proxies: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-administrator-guide/v790/configuration-using-proxies After performing the above actions, you may try to access the JasperReports Server homepage again to check if the issue is now resolved and you're able to see the homepage contents again after the upgrade. If you're still facing the issue with blank homepage contents, and are using Tomcat as the application server with SSL, the next suggestion, in addition to the above would be to configure your JasperReports Server to use only SSL. To know how to configure your JasperReports Server to use only SSL, refer the below documentation link: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-security-guide/v7/enabling-ssl-tomcat If you're still facing the blank home page contents issue even after performing all of the above actions, then please review your applicationContext-rest-services.xml (<jasperserver-pro>/WEB-INF) file and see if you've defined the roles under required beans to either enable or disable the access to homepage items to the specified roles. For more details on this, refer the below Wiki article and watch the short video to know how to enable or disable homepage items based on roles: https://community.jaspersoft.com/wiki/video-enabling-or-disabling-homepage-items-based-roles Performing the above actions should help resolve the blank homepage contents issue. If you continue to experience the same issue even after performing all of the above suggestions, consider opening a case with the Support as the issue then can be environment specific as well.
×
×
  • Create New...