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

Tom C

Jaspersoft Staff
  • Posts

    453
  • 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 Tom C

  1. Users have created and tested the configuration file for an AutoREST JDBC connection in Jaspersoft Studio (JSS) but encountered difficulties deploying the configuration file to the AutoREST data source in JasperReports Server (JRS). The Progress driver (autorest.jar) JDBC connection can use a local file to preconfigure the schema translation to achieve high performance when large amounts of data are retrieved. This Progress JDBC configuration has the "Path to Config File" parameter to let users provide the full path to that configuration file on the local drive. The "Path to Config File" setting should be the full path to the configuration file for the data source from the local drive. This Progress JDBC configuration is implemented in JRS as-is therefore the repository resource reference "repo:" is not supported in this path settings. ============================================ 20240430-TTC-2263632
  2. Below is a sample SQL query users can use to get all the report jobs listed by its associated report name, job id, next fire time, and job owner information from the JRS scheduler. The query is sorted by next fire time to help determine how the jobs are clustered for capacity planning. select TIMEZONE('EDT',TO_TIMESTAMP(q.next_fire_time/1000)) as next_job_run , TIMEZONE('EDT',TO_TIMESTAMP(q.prev_fire_time/1000)) as prev_job_run , TIMEZONE('EDT',TO_TIMESTAMP(q.start_time/1000)) as first_job_run , j.report_unit_uri as job_report_name , j.id as job_id , u.username as job_owner , t.tenantname as job_owner_org from qrtz_triggers q inner join jireportjob j on 'job_'||j.id = q.job_name left outer join jiuser u on j.owner = u.id left outer join jitenant t on t.id = u.tenantid order by 1 Sample query result: Note The query syntax is for PostgreSQL database. If users' JRS repository is using other DBs, users need to find equivalent DB functions for job name concatenation to couple the Quartz and JRS table integration, and to convert internally stored Epoch time in Quartz to a true timestamp in their respective database. With this query, users can create and deploy a report to the server and share the job information with non admin users who are not the report job owners. ================================================= 20240426-TTC-2256177
  3. select f.uri as "Report Folder" , r.name as "Report Name" , r.label as "Report Reference" from jiresource r inner join jireportunit u on u.id = r.id inner join jiresourcefolder f on f.id = r.parent_folder order by 1 reportList.xlsx ========================================================= 20240426-TTC-2255650
  4. Problem User has reported that they "have a report that runs well in the Jaspersoft Studio and the DEV report server, but it failed in the PROD report server. The Prod report server version is 7.5.0 while the dev server is 7.9.0". Analysis Jumping into conclusion, one might think the most plausible explanation of the problem is a report compatibility issue - perhaps the report template contains a design feature that only works in the new version of the JasperReports engine (JRL). Upon further review of the error message, however, the issue is not related to JRS/JRL versions used in user's production. Rather, it is caused by user's report data: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $V{GroupGrandTotal}.equals(0.0) ? "0.00%" : new BigDecimal($V{GroupItemTotal}.floatValue()*100/($V{GroupGrandTotal} .floatValue())).setScale(2, BigDecimal.ROUND_HALF_UP)+"%" ............ Caused by: java.lang.NumberFormatException: Infinite or NaN This error indicates the GroupGrandTotal report variable contains zero which cannot be used as a denominator in a division operation. User had attempted to handle this situation by this ternary expression $V{GroupGrandTotal}.equals(0.0) ?... : ... However, the BigDecimal.equals() method takes scale into consideration thus it only works when the group tally is exactly 0.0, not 0, or 0.00 nor 0.000, etc. Solution User should use the BigDecimal.compareTo() method instead to handle BigDecimal zero value evaluation irrespective of the scale: ($V{GroupGrandTotal}==null||BigDecimal.ZERO.compareTo($V{GroupGrandTotal})==0)?... : ... After making the change, the user is able to run this report successfully in all environments. Note Since the comparable interface requires a class instance to operate, users should ensure the BigDecimal field contains non null value. The normal way of using a constant literal in the ternary expression will not provide the safety net to handle the null situation when compareTo() method is used. Therefore users need to cover the null condition in the expression to be "NullPointerException" safe. Reference java.math.BigDecimal BigDecimal compareTo() Function in Java Interface Comparable -------------------------------------------------------------------------- 20240425-TTC-2260030
  5. Q: Our user has asked how they can identify whether the report is view based/domain based/topic based. A: A JRS report can be created in three ways: Query based report created in JSS using a data adapter; Domain based report created in JSS using a domain adapter; Ad hoc view report created in JRS from an ad hoc view. The ad hoc view in turn can be created from a domain, a query based report topic, or a domain based topic. But those resources are only relevant to the ad hoc view, not directly related to the report. To determine which three of the above data sources a JRS report unit is using, we need to look no further than the jireportunit table itself. The resourcetype column contains the class type which can help to identify the report data source: com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource and com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JndiJdbcReportDataSource indicate this is a query based report using JDBC and JNDI data source , respectively; com.jaspersoft.ji.adhoc.AdhocDataView is for ad hoc view report; com.jaspersoft.commons.semantic.datasource.SemanticLayerDataSource identifies a domain based report. Here is the sample query to fulfill the request. select r.name as reportName , f.uri as reportFolder , rd.name as reportDataName , rd.resourcetype as reportDataType from jiresource r inner join jireportunit u on u.id = r.id inner join jiresourcefolder f on f.id = r.parent_folder inner join jiresource rd on rd.id = u.reportdatasource
  6. Yes. You can use sub dataset to run difference query from the main query in the report. Please refer to:
  7. Configuring Google Global Load Balancer (GLB) With Sticky SessionJasperReports Server (JRS) supports partial session replication but not full replication, the load balancer must be configured so that browser users are always connected to the same server during a continuous session. This requirement is referred to as "sticky or pinned sessions" (refer to https://community.jaspersoft.com/documentation/tibco-jasperreports-server-ultimate-guide/v790/session-management-and-failover). To fulfill this requirement, when using Google Global Load Balancer (GLB) to host multiple JRS instances, our users deploy a "ring hash" load balancing strategy. The ring hash approach is used for both “sticky sessions” with a cookie and for “session affinity” based on primarily the client IP address to send all requests from a given client to the same server node. The ChallengeHowever, with the ring hash load balancing strategy, our users had discovered based on their trial run, that all their 300 users' requests only hit one JRS node defeating the LB distribution functionality. There's an inherited tradeoff with ring hash which can be more challenging to evenly distribute workload because the hashing is involved with the distribution of keys or requests in the system. To support full session replication in order to lift the restriction on sticky session requirement and avoid use ring hash, JRS will have to go through a major architecture design change to make it possible. Recommendations to GLB System Admin - Ensure that the hash keys are well-distributed across the ring. If the keys used for hash mapping are not distributed uniformly across the ring, it can lead to hotspots where all requests are directed to the same node. - Verify that the hash function used is suitable for the specific use case. If the hash function has poor distribution properties, it can lead to an uneven distribution of keys and, consequently, uneven traffic to the server nodes. - Adding more nodes to the hash ring can help mitigate this issue. With only a few nodes, the distribution of keys is inherently less even. - Using a hash function with a low collision rate and handling collisions properly is important. Hash collisions occur when different keys or requests are mapped to the same position on the hash ring which can lead to uneven distribution. - Implement weighted distribution to account for data skew. If certain keys or requests are more common than others, this can lead to uneven distribution. - Explore the option to use L7 proxy for round robin load balancing. Reference Materials https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers https://blog.getambassador.io/load-balancing-strategies-in-kubernetes-l4-round-robin-l7-round-robin-ring-hash-and-more-6a5b81595d6c#:~:text=the%20given%20service.-,Ring%20hash,client%20to%20the%20same%20Pod https://www.toptal.com/big-data/consistent-hashing ============================ TTC-20231017
  8. import net.sf.jasperreports.engine.JRDataSource; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.view.JasperViewer; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; public class JasperReportWithSubreports { public static void main(String[] args) { // Create a connection to your database Connection connection = createDatabaseConnection(); // Load the compiled main Jasper report (.jasper file) JasperReport mainReport = loadCompiledReport("path/to/main/report.jasper"); // Load the compiled subreport (.jasper file) JasperReport subReport = loadCompiledReport("path/to/sub/report.jasper"); // Set parameters for the main report Map<String, Object> parameters = new HashMap<>(); parameters.put("ReportTitle", "Sample Report"); parameters.put("CompanyName", "ABC Corp"); parameters.put("subReportParameter", subReport); // Pass the subreport to the parameter // Fill the main report with data using a JRDataSource implementation JRDataSource dataSource = createDataSource(); JasperPrint jasperPrint = null; try { jasperPrint = JasperFillManager.fillReport(mainReport, parameters, dataSource); } catch (Exception e) { e.printStackTrace(); } // Display the report in a viewer (optional) if (jasperPrint != null) { JasperViewer.viewReport(jasperPrint, false); } // Close the database connection try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } // ... Same createDatabaseConnection, createDataSource methods as before ... private static JasperReport loadCompiledReport(String reportFilePath) { JasperReport jasperReport = null; try { jasperReport = (JasperReport) JRLoader.loadObjectFromFile(reportFilePath); } catch (Exception e) { e.printStackTrace(); } return jasperReport; } }
  9. You can use a table element with print when condition on the column to hide it; and the rest of the columns to its right will get auto moved to the left to place its void. The print when condition however needs to be determined before the table elements are being laid out. In addition, the width of the report field is fixed at the design time therefore you cannot expand the field width dynamically at the run time. (The stretch can only be applied to the report field height, not the width when its content is overflown).
  10. The content of jireportjobparameter.parameter_value field is a Java object that only the JRS class method can decipher, such as (with bytea 'escape' encoding): 25435500sr00java.util.ArrayListx201322231307a23500I00sizexp000000w000000t001t003x Instead of attempting with SQL query to encode, you should use JRS REST call report job service to get the listed parameter values from the job definition: GET http://<host>:<port>/jasperserver[-pro]/rest_v2/jobs/<jobID>/ From the return of the REST call, you should see the parameter information in the json job descriptor, something like: "source": { "reportUnitURI": "/public/TTC/Slack/20230602/Cascading_multi_select_topic", "parameters": { "parameterValues": { "Country_multi_select": [ "USA" ], "Cascading_name_single_select": [ "A & U Stalker Telecommunications, Inc" ], "Cascading_state_multi_select": [ "CA", "OR" ] } } }, --------------------------------------------------------- For more information, please refer to "TIBCO JasperReports® Server REST API Reference" document. https://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v790/jobs-service#Viewing_a_Job_Definition
  11. I am not sure Java Long class by default display the scientific notation unless you format it in the report template. Do you have a sample report template (JRXML file) and its output to demonstrate the issue?
  12. JasperReports engine (JRL) is a Java application, not a scripting application, therefore you cannot use string substitution directly in the text string. What you can do, however is to use Java string substitution class method to achieve your goal: $F{INTRODUCTION}.replace("$F{NAME}", $F{NAME})
  13. TIBCO JasperReports® Server Security Guide Software Release 8.0 section 4.4.3 Customizing Query Validation If you wish to use a different validator expression for queries, always create a new validator expression with a new name in validation.properties, then substitute that name in the validation rule in security.properties. For example, if you wish to forbid queries from running stored procedures in your database, you can add the following validator expression in validation.properties: #Validator.ValidSQL=(?is)^\s*(select|call)\b((?!\binto\b)[^;])*;?\s*$ Validator.ValidSQLnoProc=(?is)^\s*(select)\b((?!\binto\b)[^;])*;?\s*$ Then you would uncomment and modify the validation rule in security.properties as follows: # Main SQL execution point sqlQueryExecutor=Alpha,ValidSQLnoProc,500000,true,SQL_Query_Executor_context It is also possible to have two or more validation rules that will be applied sequentially (logical AND) until one fails. The rules must have the same names but with a numerical suffix, for example: # Main SQL execution point sqlQueryExecutor=Alpha,ValidSQL,500000,true,SQL_Query_Executor_context sqlQueryExecutor2=Alpha,ValidSQLCustom,500000,true,SQL_Custom_Executor_context With multiple rules for query validation, each rule is applied in the order listed until one fails. When one rule fails, the whole validation fails.
  14. Issue: 1) Report "has a Multi select parameter which is String datatype", such as ["USA",...] 2) "Input control : It is single select query", therefore the value is "USA". Problem: Can not use single select input to feed report collection parameter. "USA" --> ["USA",...], incorrect. Resolution: Use MULTI select input control instead. ["USA",...] --> ["USA",...]
  15. You need to use Java BigDecimal class with two decimal rounding up precision to carry out the calculation.
  16. Refer to: https://community.jaspersoft.com/wiki/sample-report-display-image-stored-jasperreports-server-repository
  17. 1) produce list of employees and list of department in two separate reports; 2) create a main report to call those two sub reports and produce multi-sheet xls report output as demonstrated here: https://community.jaspersoft.com/wiki/sample-report-creating-multi-sheet-xls-report-output-subreports
  18. You can use sub report for group process to avoid accidental sheet break. Refer to sample report at https://community.jaspersoft.com/wiki/sample-report-creating-multi-sheet-xls-report-output-subreports
  19. 1) Refer to https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm to set the correct cron expression for the last day of month report execution. for example: 0 15 10 L * ? Fire at 10:15 AM on the last day of every month 2) Create a Calendar Recurrence type job with any settings such as Every Month Every Day 0 hour and 0 minute from JRS scheduler web UI. 3) After the job is created, find the job ID, such as 20318 and use it in the following SQL to update this job's cron expression to run it on the last day of the month. update qrtz_cron_triggers set cron_expression = '0 15 10 L * ?' where trigger_name = (select trigger_name from qrtz_triggers where job_name = 'job_20318')
  20. You are setting the hyperlink for the entire chart. You need to instead set the hyperlink for the chart measure in order pass the slice value for that particular measure to a drill down report. Refer to: https://community.jaspersoft.com/wiki/html5-charts-measure-and-bucket-properties Examples: https://community.jaspersoft.com/wiki/how-do-i-set-chart-hyperlinks-html5-charts https://community.jaspersoft.com/wiki/video-passing-multiple-values-pie-chart-slice-highcharts-through-hyperlink
  21. "one OCPU and 1GB of RAM"? I cannot imagine a machine with that configuration can do any meaningful data processing work in 2022. FYI, Windows 11 has the following minimum hardware requirements: Processor: 1 gigahertz (GHz) or faster with two or more cores on a compatible 64-bit processor or system on a chip (SoC). RAM: 4 gigabytes (GB) or greater.Refer to https://support.microsoft.com/en-us/windows/windows-11-system-requirements-86c11283-ea52-4782-9efd-7674389a7ba3 And the recommended minimum system requirements for Ubuntu desktop edition is 2 GHz dual core processor 4 GiB RAM (system memory)Refer to https://help.ubuntu.com/community/Installation/SystemRequirements This is just to get the OS up and running and we are not talking about running a web application server (Apache-Tomcat) and database (PostgreSQL) on this machine to support JasperReports Server (JRS) web application. People can spend $300 to buy a Lenovo laptop with 2 core CPU and 4G RAM from Costco and meet that requirement. https://www.costco.com/lenovo-ideapad-1-15.6%22-laptop---intel-pentium-silver-n6000---1080p---windows-11-s-mode---microsoft-365-personal-(1-year-subscription).product.100858024.html
  22. Only the commercial edition of JasperReports Server (JRS) has the ad hoc feature which allows users to create an ad hoc view report directly in the JRS web flow Ad Hoc designer. Free community edition does not offer this feature. The JRS commercial edition (AKA "professional" edition) has pro charts, dashboard, OLAP, multi-tenancy, and audit components that the open source community edition does not offer. The JRS pro installation package comes with the full feature of the product. Depending on the licensing contract (how much users are willing to pay), users can get either a Professional license or an Enterprise license to activate the multi-tenancy and audit features. The rest of the pro features are available to both types of the JRS pro licenses. Hope this clarifies the issue.
×
×
  • Create New...