-
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
Security Advisories
Downloads
Posts posted by Tom C
-
-
What is in your report parameter pWhereClause?
-
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;
}
}
-
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).
-
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.
-
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?
-
-
Try org.apache.calcite.jdbc.Driver
-
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",...]
-
Try this to see if it'll help.
https://community.jaspersoft.com/wiki/creating-report-using-json-data-parameter-subreports
-
You need to use Java BigDecimal class with two decimal rounding up precision to carry out the calculation.
-
-
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:
-
You can use sub report for group process to avoid accidental sheet break. Refer to sample report at
-
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
-
"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.
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.
-
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.
-
FYI
Jaspersoft Studio = JSS
JasperReports engine/library = JRL
JapserReports Server = JRS
-
-
-
User a left outer join to display all classes in this crosstab report even for the class that has no student registration.
select .......from class_table cleft (outer) join on registration_table r where c.classid = r.classid[/code]
-
This is a SQL query issue that has nothing to do with our product. You need to use joins to lift data from multiple tables, something like
select t1.a, my_function(t1.p1,t2.p2), t2.b, DECODE(t1.C, '1', 'M.', '2', 'Mme')from tab1 t1inner join tab2 t2 on t1.id = t2.id[/code]
Please take some SQL training classes (and Java classes) to get yourself familiar with the technology to use our product effectively. You may find this YouTube video useful and helpful:
https://www.youtube.com/watch?v=rocjHUQf5n0
Good luck and happy coding. :)
- 1
-
"jasperreports-server-cp-8.0.0" is a package for the open source community edition which does not contain licensed components. You will need to get a JRS commercial edition (AKA enterprise/professional edition) to use this licensed "TIautorest-6.0.0.004291.jar" through a product subscription. .
-
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 8.0.1.final using JasperReports Library version 6.11.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="demo20220303" pageWidth="612" pageHeight="792" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="6a28a568-5cd4-4fc1-9e28-015213d63b58">
<parameter name="Input String" class="java.lang.String">
<defaultValueExpression><![CDATA["apple, banana, strawberry, lemon"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="79" splitType="Stretch">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="570" height="30" backcolor="#FFFF00" uuid="e4fc6e91-9a90-4b32-98e2-7355e3b81afe"/>
<textFieldExpression><![CDATA["INPUT STRING: "+$P{Input String}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Opaque" x="1" y="40" width="570" height="30" backcolor="#33FF00" uuid="323b73b5-269c-42ad-a1ad-a6689316fc8c"/>
<textFieldExpression><![CDATA["Modified String: "+$P{Input String}.replaceFirst(",([^,]+)$", " and$1")]]></textFieldExpression>
</textField>
</band>
</title>
</jasperReport> -
You can use a regular expression to replace the last comma in a string to "and":
$V{yourString}.replaceFirst(",([^,]+)$", " and$1")
Several SQL queries.
in Products
Posted
Yes. You can use sub dataset to run difference query from the main query in the report. Please refer to: