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

prusyn

Members
  • Posts

    45
  • 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 prusyn

  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.
  16. Issue:[toc on_off::hide=1] A user has this report they migrated from 6.2.0 to 7.1 and now the report is rendered with empty table cells. All the pages are there, but data is not visible. When exporting to PDF the data is displayed just fine. Resolution:The problem is caused by the padding set in the default style of the report. Starting with JasperReports Library 6.2.2, the default style is used as parent for other styles, in addition to being used for elements with no style set. Thus the padding applies to table cells and in HTML it causes the cell contents not to be displayed because there's no space for both the padding and the contents. Defect JRL-1414 has been submitted for this usecase. There are two workarounds for for the problem. The first is to remove the padding from the default style in the report. The second is to set the following property in jasperreports.properties (this would of course apply to all reports): net.sf.jasperreports.styles.inherit.from.default=false[/code]
  17. Issue:[toc on_off::hide=1] Customer has a report designed in Jaspersoft Studio, in which there is a table that uses its dataset (subdataset). For this subdataset customer has defined a variable. Now he wants to display the value of this variable in report itself, outside the table. Which means he needs to pass the variable value from sub dataset to main dataset. Which is impossible by default. Customer receives error "You drop an object from a subdataset into the report": http://prntscr.com/n2mezy Resolution:In order to pass variable value from sub dataset to main dataset, you have to define variable in main dataset with calculation System: <variable name="Counter" class="java.lang.Integer" calculation="System"/> Now you should add returnValue property into datasetRun section like below. It takes fromVariable (the one from subdataset) and toVariable (the one from main dataset): <datasetRun subDataset="Dataset1" uuid="b793d24c-3ae9-4ded-b083-ff57b900a2b8"> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <returnValue fromVariable="Total Summary" toVariable="Counter"/> </datasetRun> See report attached. sampletable.jrxml
  18. There are a bunch of approaches, which depend on your java knowledge. For example, expressions: A) String.format("%.2f", new BigDecimal(Double.parseDouble($F{sample})))[/code]B) new DecimalFormat("0.00").format(new Double($F{sample}))[/code]where $F{sample} is a field from dataset, that contains numbers. I used sample query: select '25.45060506506456' as sample[/code]Also, attaching report.
  19. Hozawa's answer is correct, but to be more specfic to your requirements you need below expression: "Report created " + new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a z").format(new java.util.Date())[/code]Here's you find more information about date format patterns: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
  20. what is the problem? if field used as a measure in your dataset contains negative values, they will be displayed in a chart. Can you describe your usecase in more details?
  21. Issue:[toc on_off::hide=1] Customer has a requirement to display Data label numbers in the Indian Number Format with Comma, upto 2 decimal places. Indian Number format (lakh, lakhs, crore, crores, koti, kotis) is something like that: 123456524578 -> 1,23,45,65,24,578. Resolution:Such effect can be achieved by using formatter functions on Data labels. HTML5 Charts or HighCharts allow usage of JavaScript functions as property values. But before you can use functions, you need to enable them. This article is going throught steps for enabling this feature for TIBCO Jaspersoft® Studio and TIBCO JasperReports® Server: https://community.jaspersoft.com/wiki/using-functions-html5-charts-highcharts You can format your Data labels using the plotOptions.bar.dataLabels.formatter property. It requires a callback function that will be called every time a data label will be generated and the formatting will be applied. For example: <hc:chartProperty name="plotOptions.bar.dataLabels.formatter"> <hc:propertyExpression><![CDATA["function() {var label = this.y; x = label.toString();var lastThree = x.substring(x.length-3);var otherNumbers = x.substring(0,x.length-3);if(otherNumbers != ''){lastThree = ',' + lastThree;}var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;return res;}"]]> </hc:propertyExpression></hc:chartProperty>[/code]This is the result: http://prntscr.com/mpvzw2 Also, attaching sample report to demostrate this behavior. It uses default Sample DB Dataadapter, so you should easily be able to execute it.
  22. Issue:[toc on_off::hide=1] Customer has a requirement to display Axis label numbers in the Indian Number Format with Comma, upto 2 decimal places. Indian Number format (lakh, lakhs, crore, crores, koti, kotis) is something like that: 123456524578 -> 1,23,45,65,24,578 Resolution:Such effect can be achieved by using formatter functions on labels. HTML5 Charts or HighCharts allow usage of JavaScript functions as property values. But before you can use functions, you need to enable them. In TIBCO JasperSoft® Studio (Windows): Go to Window -> Preferences -> Select JasperSoft Studio category -> Select Properties category -> First type in the filter field "functions.allowed" to check if you already have the property. If you don't see anything returned by the search, press Add Property name: com.jaspersoft.jasperreports.highcharts.function.properties.allowed Property value: true In TIBCO JasperReports® Server: Go to your application server and navigate to the JasperReports Server WAR file (expoloded/unexploded). Go to /WEB-INF/classes Edit jasperreports.properties file -> Append com.jaspersoft.jasperreports.highcharts.function.properties.allowed=true Save the file and restart the application server. You can format your chart Axis labels using the yAxis.labels.formatter and yAxis.labels.formatter properties. It requires a callback function that will be called every time a data label will be generated and the formatting will be applied. For example: <hc:chartProperty name="yAxis.labels.formatter"> <hc:propertyExpression><![CDATA["function() {var label = this.axis.defaultLabelFormatter.call(this);x = this.value.toString();var lastThree = x.substring(x.length-3);var otherNumbers = x.substring(0,x.length-3);if(otherNumbers != ''){lastThree = ',' + lastThree;}var res = otherNumbers.replace(/\\B(?=(\\d{2})+(?!\\d))/g, \",\") + lastThree;return res;}"]]> </hc:propertyExpression> </hc:chartProperty> for xAxis: <hc:chartProperty name="xAxis.labels.formatter"> <hc:propertyExpression><![CDATA["function() {var label = this.axis.defaultLabelFormatter.call(this);x = this.value.toString();var lastThree = x.substring(x.length-3);var otherNumbers = x.substring(0,x.length-3);if(otherNumbers != ''){lastThree = ',' + lastThree;}var res = otherNumbers.replace(/\\B(?=(\\d{2})+(?!\\d))/g, \",\") + lastThree;return res;}"]]> </hc:propertyExpression> </hc:chartProperty> In Studio, this property can be edited from UI, using Advanced Chart Properties: http://prntscr.com/mh8ze3 Also, attaching sample report to demostrate this behavior. It uses default Sample DB Dataadapter, so you should easily be able to execute it. Related links: https://community.jaspersoft.com/wiki/using-functions-html5-charts-highcharts indiannumericreport_2.jrxml
  23. Not being familar with crystal reports, this is not much helpful. Can you specify what are you trying to acheive? As I understand you are trying to build date out of three integers. Is that correct?
  24. Hi, can you post here some screenshots or sample xls export of your current and expected behavior? Regards, Pavlo
  25. Issue:[toc on_off::hide=1] The visualize.report interface exposes the updateComponent function that gives your script access to the JIVE UI. Using the updateComponent function, you can programmatically interact with the JIVE UI to do such things as set the sort order on a specified column, add a filter, and change the chart type. In addition, the undoAll function acts as a reset. Customer would like to apply its own filtering/sorting actions instead of JasperReports Server default JIVE. But customer faced issues while tried to get report name and perform actions on it. Resolution:1. You can provide a name to every component by adding additional property: <property name="net.sf.jasperreports.components.name" value="test"/>[/code]JIVE actions like filter/sorting would work for simple text field. For more information, please check: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-visualizejs-guide/v71/api-usage-interactive-reports#Interacting_With_JIVE_UI Another issue is - JIVE is disabled for fields that contains complicated expressions. For example: $F{name} == null || $F{name} =="" || LEN(TRIM($F{name} ) ) != 0 ? $F{name} + "true" : $F{name} + "false"[/code]The reason behind it is that interactivity of a column such as filter, conditional formatting or sorting is related to the type of values displayed by that column. Text and numbers and dates have different sorting and filtering criteria, so it is important to know the type of the date in the column. When using a complex expression with more than a field or variable in it, we cannot know the type of the values produced by the expression anymore. So we don't know how to sort it or how to filter the values. When the expression is put back into a variable, and the single variable is part of the column expression, we know the type, because variables have a type. As a solution you can place expression in variable and use this variable in text field expression. Please, check this screencast: https://screencast-o-matic.com/watch/cqVT6b3uOU
×
×
  • Create New...