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


  • Posts

  • Joined

  • Last visited

prusyn's Achievements


Contributor (5/14)

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

Recent Badges




Community Answers

  1. It is applicable for all datatypes supported by JasperReports AFAIK. The reason why it didn't work for you was because you tried to use calculation on variable that does not work on Strings and only works on Numbers: https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v750/other-properties-variable
  2. If you want to use calculations, you have to use Numbers, at very least variable type should be Integer, not String, cause SUM function returns Number value.
  3. Your fromVarField3 variable is type of String, but is set to calculation="Sum". Why? What is the logic behind that? With its current implementation it will not work. Can you please download the sample attached to the article and check it?
  4. Can you provide jrxml file of the report you have issues with?
  5. Usecase:[toc on_off::hide=1] I would like to control report locale picked by JasperReports Server using parameters of the report, not the user session locale. Is this achievable at all? Resolution:At this moment, based on locale used by user in JasperReports Server, the report will be executed using different bundle file. Take a look in this screencast: http://somup.com/cq1hIdnJQl If you want to run report with french locale, user should be logged in with french locale as REPORT_LOCALE parameter is defined during report execution and it cannot be overwritten. There is a way to do something similar, but the change has to be made on report level. The idea is to overwrite default REPORT_LOCALE parameter of subreport. By default you cannot overwrite this parameter for main report because it takes its value from the system. So, steps are next: Create an empty report;Create parameter LanguageCreate its subreport and define its parameter REPORT_LOCALE like below:<subreport> <reportElement x="0" y="0" width="560" height="560" uuid="16df228b-dfbb-4725-81dd-41ebc45a50a7"/> <subreportParameter name="REPORT_LOCALE"> <subreportParameterExpression> <![CDATA[new java.util.Locale($P{Language})]]> </subreportParameterExpression> </subreportParameter> <connectionExpression> <![CDATA[$P{REPORT_CONNECTION}]]> </connectionExpression> <subreportExpression> <![CDATA["ChildReport.jasper"]]> </subreportExpression> </subreport> Add several resource bundle files.Upload everything to JRSEnjoy the ability to schedule the report in locale you want.I prepared a screencast which demonstrates this behavior: http://somup.com/cq11o2nJGr Also, new project attached with all of resources. reportlocale.zip
  6. Issue:[toc on_off::hide=1] User has created a report with an Input control of type Collection (Multiselect) from jasper studio. Input control loads data from the Query. In Jasper server, he needs a default value to be set for the filter. He tried to keep below expression in "Default Value Expression" secton of the Parameter properties: (java.util.Collection)(Arrays.asList("NO")) ("NO" is the one the result set)new ArrayList(Arrays.asList(new String[] {"NO"}))None of them are working. Why? Resolution:It turns out the export zip of the reports customer sent contained a data snapshot for the report. So, we made a conclusion that customer has enabled data snapshot persistence in the instance. So, what happens is - when a report has a saved data snapshot, the parameter values that correspond to the data snapshot are used as defaults in favor of parameter default value expressions. Therefore it could be that the report data snapshot contains parameter values that are different from the default values. To resolve this you have to open the report, change the parameter values to the desired defaults, run the report and then save it (from the report viewer). That would overwrite the existing data snapshot with a new one with different parameter values.
  7. Issue:[toc on_off::hide=1] The Customer is trying to use the show/hide columns functionality of jasper report table component. When they try to show hidden columns, it is showing the column number instead of column name. Here's the screenshot of the issue: Below is the snippet from the jrxml file for a report which produces this error. Resolution:So, the issue here is that the columns are called Column_x because the column headers are empty. Normally, the column name is the text in the column header but if the header is empty, these generated names are used. Unfortunately, there is no way you can use table group headers names instead of table column headers. The current JIVE implementation for report interactivity allows only to work with column headers. However, we have an enhancement request to implement JIVE feature on Table Group Header with internal ID JS-55803.
  8. Issue:[toc on_off::hide=1] Customer is using JasperServer and facing an issue with date fields. If they feed the jrxml with date like 31 Dec-2019, the report generated by jasperreports shows the same date as 31 Dec-2020. The issue of advancing the year by 1 happens only if date is 31 and month is Dec. Below is the snippet from the jrxml file for a report which produces this error. <jr:column width="140" uuid="3eb47b2b-9fb1-4c97-afdb-c0ca1d2f0a37"> <jr:columnHeader height="36"> <staticText> <reportElement style="th" x="0" y="0" width="140" height="36" uuid="ca7ec5e5-5c56-4bc9-849d-6bdb1ef5bc0d"/> <text> <![CDATA[Original due date]]> </text> </staticText> </jr:columnHeader> <jr:detailCell height="30"> <textField isStretchWithOverflow="true"> <reportElement style="td" stretchType="RelativeToBandHeight" x="0" y="0" width="140" height="30" uuid="e1bb822a-7cc1-4813-b41d-11e84c935382"/> <textFieldExpression> <![CDATA[$F{originalDueDate}]]> </textFieldExpression> <patternExpression> <![CDATA["dd MMM YYYY"]]> </patternExpression> </textField> </jr:detailCell></jr:column>[/code]Resolution:The error comes from pattern expression you use. When you are formatting dates in Java there is a subtle difference between YYYY and yyyy. They both represent a year but yyyy represents the calendar year while YYYY represents the year of the week. That’s a subtle difference that only causes problems around a year change so your code could have been running perfectly fine all year only to cause a problem in the new year. To solve this, use yyyy instead of YYYY in pattern expression: <patternExpression> <![CDATA["dd MMM yyyy"]]></patternExpression>[/code]
  9. Issue:[toc on_off::hide=1] Customer followed this tutorial to enable callback function for highcharts: https://community.jaspersoft.com/wiki/using-functions-html5-charts-highcharts This works if the report type is JasperReports® Library. As soon as customer changes the the Report Repository Type to TIBCO JasperReports® IO, the provided function is not applied and the default Formatter value is taken. Resolution:HTML5 Charts or HighCharts allow usage of JavaScript functions as property values. You can even use the functions to return objects with dynamic values to the charts and like that create plotlines and other neat things. But before you can use functions, you need to enable them by adding com.jaspersoft.jasperreports.highcharts.function.properties.allowed = true to TIBCO JasperReports® Server or TIBCO JasperSoft® Studio default properties as mentioned in the article above. The same goes for JasperReports® IO. To allow callback functions you need to allow them in jrio-1.1.0repositorysamplesJR-INFcontext.xml file. You need to add the same property as below and restart the JasperReports® IO instance: <context xmlns="">... <properties>... <property> <name>com.jaspersoft.jasperreports.highcharts.function.properties.allowed</name> <value>true</value> </property> </properties> </context>[/code]
  10. Issue:[toc on_off::hide=1] Customer made an example of a Book Report containing other 3 reports having a table component. It appears, being exported to DOCX, there are several issues obeserved: Report1 and Report2 left border of all elements in the first column is not displayed and the bottom border when printing the word document it is deleted. The same problem when the report is execute as a stand alone report and not as part of the groupThere is the issue in Report2 that the cell doen't adjust in size when the report is executed as a book, and works just fine when it is execute as a stand alone report.Report 3 problem is that when the report is a part of the book, all the text even if it is set to Arial 6, are set as Arial 8. This problem is only visible if the book is executed, if the report is executed as a stand alone report it works fine.Also, PDF and Powerpoint export looks fine. Only DOCX seems to be corrupted. Reports and the book are attached. Resolution:1. Regarding the table borders problem, you need to set the property below in the Book.jrxml file. net.sf.jasperreports.export.docx.frames.as.nested.tables = false[/code]2. The problem with cell size adjustment can be fixed by setting the property below in the book.jrxml and also choosing top margin = 0, left margin = 0, bottom margin = 0 and right margin = 0 in the book.jrxml. All page margins should be 0 in this case. net.sf.jasperreports.export.docx.flexible.row.height = true[/code]These setting are only for book.jrxml 3. The error with Report 3 appears to be a defect, which were submitted to our internal tracking system with ID JRL-1419. The problem happens because the same style name appears in several reports. Therefore one workaround is to change the name of the Table_TD_Value style in Report3 to a name that's unique across the reports that are part of the book.
  11. What user are you trying to execute the report as? Only superuser can see absolute path to resources, like /organizations/org_name/path/to/resource/ To make report available for the user from the organization, you need to specify relative path to the resource. If the absolute path is repo:/organizations/org_name/path/to/resource/ then relative path would be repo:/path/to/resource/
  12. Use case:[toc on_off::hide=1] Customer has noticed that there appears to be a large difference in PDF output sizes between reports produced in Ad-Hoc vs similar reports produced within Studio and run on the server. This size difference appears to affect both the size of the file and the amount of time / memory used on the server whilst the export is being generated. The amount of time to produce the files and the resultant file sizes vary hugely, sizes are below: Studio Report : 28,764 KB Ad-Hoc Report : 196,728 KB The page counts between the two report differ slightly but that is because the row count per page is slightly different - 28 rows on the studio report vs 29 on the ad-hoc report, so the studio based report actually has more pages than the ad-hoc - The page size is also slightly different but I wouldn't think it was enough of a difference to be a problem (14in * 10in for Studio and 11in * 11in for ad-hoc). Also, customer has also noticed that the two exports appear to create different PDF versions - 1.5 for the Studio report and 1.4 for the ad-hoc report. Issue:An example customer was working on - 200,000 rows with 33 columns (again, tested reports written in Studio one Ad-Hoc): Studio report - JRS memory reached 1.9GB while report was executing and returned file was 35.4MBAd-Hoc report - JRS memory reached 4.97GB and then hung tomcatJRS did not produce an out of memory error but tomcat completely stopped responding. Clearly such a large increase, both in terms of memory usage and file size has (potentially at least) quite a large impact on our hosted systems which are often running tens of customers per instance and potentially thousands of users. Resolution:The Adhoc PDF is much bigger because it includes 508 tags by default. If you edit the Adhoc report's JRXML and set the net.sf.jasperreports.export.pdf.tagged property to false, it will produce a 4MB PDF file: <property name="net.sf.jasperreports.export.pdf.tagged" value="false"/>[/code]Unfortunately, this property is hard coded. As far as I can see in the code, the property is always set to true for Adhoc reports. It overrides both template properties and global properties. Therefore I don't think there's a way to globally set it to false. There is an enhancement request JS-34525 for ability to set this property globally. So, at this moment this property has to be defined per Adhoc Report JRXML file.
  13. Use case:[toc on_off::hide=1] Customer has a few reports that utilize the detail band to iterate through 60-100 records and display a high chart (a simple one bar "gauge" type chart). They have noticed that the performance of the highcharts rendering really slows down the report. The data comes back within a few seconds, but then the report has to "wait" until each high chart renders. Result report contains about 100 bar charts in a single page: Issue:It appears, charts (especially in every page) significantly increase report execution time. Also, render time depends a lot of its appearance ( how customized is it). Also, it is not always the best practice to place charts in detail band of the report. Unless that's what are your requirements. Resolution:Important note: This resolution can fully be applicable only to this usecase. For other types of charts or usecases, this article can be considered as a list of possible suggestions of how to improve charts rendering time. First - Given that the charts are just a simple bar charts, one option would be to give up using Highcharts and write some code that creates SVGs or PNGs for the charts. Or you can even write the SVG directly in the image expression. I shall attach "image_sample" report, as an example. But it appears, it's not especially pretty. Second - If you need to stick to Highcharts, there might be a few changes that would slightly improve the time it takes to render the charts. For instance you can set the com.jaspersoft.jasperreports.highcharts.interactive property to false (at chart element level) to disable the interactive chart type change action. And maybe, depending on the chart type, some chart properties can be tweaked to reduce the work done by Highcharts. Regarding this, it seems that setting the com.jaspersoft.jasperreports.highcharts.interactive to false for the element, and setting the xAxis.labels.enabled and yAxis.labels.enabled chart properties to false resulted in a noticeable performance improvement (on Chrome at least). Also, attaching the "chart_sample" report that I tested. Other changes in the way the charts are rendered would involve modifying the JR/S JavaScript code. A cleanup might also help to some degree, the chart seems to have several properties that are useless (e.g. plotOptions.pie.showInLegend). chart_sample.jrxml image_sample.jrxml
  14. Issue:[toc on_off::hide=1] Customer is using sorting in some columns in a table in jrxml. But the concern is when a report is generated it is showing one sorting icon in the title like a triangle. The desire is to hide it from UI. Resolution:First of all, this is the indicator of what sorting is used on the column. This is a pretty necessary part of report usability. So, under normal cirumstances you don't want to remove it. However, if you still want to do it, you will have to set these properties in jasperserver-proWEB-INFclassesjasperreports.properties and restart the server. net.sf.jasperreports.components.sort.down.arrow.char=u0020 net.sf.jasperreports.components.sort.up.arrow.char=u0020It will set icons of sort chart to Space which will make them unseen. sc.mp4 .In fact, you can set these properties to any char value recognized by Java to change the appearance of sorting icons. sc.mp4
  15. Use case:[toc on_off::hide=1] A user has a multiselect parameter of type java.util.Collection and Nested type is java.lang.String. He has to pass the selected value in array field like below - AND l."groupIds" && ARRAY['String1', 'String2] [/code]here ARRAY[selected_param_value]. Issue:$X{} construction does not work. It appears, operator array_field && ARRAY[] works a bit differently. If there is atleast one element in ARRAY that exists in atleast one row of array_field, this field gets displayed. $X{} won't work here, as, it does not support array function such as PostgreSql overlap for a table column. Resolution:In attachments you can find a sample report i developed for the reference. You will also need a sample data. The sample table can be created using query below: Query for table: CREATE TABLE posts ( title text NOT NULL PRIMARY KEY, tags text[] ); INSERT INTO posts (title, tags) values ('1', '{"postgres", "replication"}'), ('2', '{"go", "queues", "goroutines"}'), ('3', '{"postgres", "go", "triggers"}'), ('4', '{"mysql", "monitoring", "opsdash"}'); [/code]My example is for Strings but it can be done for any type. So, basically the idea is next: Create parameter type of java.util.List, nested type String (in that case), as below. Providing default value expression is optional. I did it just to not waste time applying parameter values. <parameter name="ValuesList" class="java.util.List" nestedType="java.lang.String"> <defaultValueExpression><![CDATA[Arrays.asList(new String[] {"postgres", "go", "mysql"})]]></defaultValueExpression> </parameter> [/code]Create parameter type of String, which parses the list we created in step 1 and makes it readable by psql syntax. Note, it should be String, also, DefaultValueExpression is essential, and prompting should be disabled. <parameter name="FinalParam" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[$P{ValuesList}.toString().replace("[", "'{").replace("]", "}'")]]></defaultValueExpression> </parameter> [/code]Use second parameter in query like below: <queryString language="SQL"> <![ CDATA[ select * from posts where tags && $P!{FinalParam} ] ]> </queryString> [/code]Please, note: query uses parameter with syntax $P! with "!" symbol. It is required for parameter to be passed to query as plain text, not being evaluated. If evaluated the report with throw the error regarding casting type.
  • Create New...