Jump to content
Changes to the Jaspersoft community edition download ×


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

191 profile views

tchen's Achievements

  1. 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
  2. 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; } }
  3. 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).
  4. 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
  5. 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?
  6. 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})
  7. 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",...]
  8. You need to use Java BigDecimal class with two decimal rounding up precision to carry out the calculation.
  9. Refer to: https://community.jaspersoft.com/wiki/sample-report-display-image-stored-jasperreports-server-repository
  10. 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
  11. 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
  12. 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
  • Create New...