SubDataSet in iReport [duplicate] - jasper-reports

This question already has answers here:
Multiple queries in a single jasper document
(2 answers)
Closed 9 years ago.
I want to use multiple queries in my report. But the main report allows me only one main query, however, I have found a way to have multiple queries in my report and that is done by subdataset in iReport. But I am unable to access the fields of my subdataset in my main-report. How to do that?
Thanks!

To view your sub data set you must use it in a chart, list, table etc.
Here is a great explanation:
Multiple queries in a single jasper document

Related

Jasperreports Studio - check if rows ins subreport contain a specific value [duplicate]

This question already has answers here:
How to pass value/variabile from subreport to main report?
(3 answers)
Count number of rows where a field is a specific value
(2 answers)
Closed 1 year ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
we're currently working on some delivery note Jasper Reports.
I have a main report and the detail band contains a subreport that shows the related articles.
The main report should show a specific scentence but only when one of the articles has a specific articlenumber.
I am pretty sure that we have to create two variables (one in the main report and one in the subreport).
Is there a way to iterate over all rows in the subreport return the result accordingly ?
This is what the code would look like in Java (for demonstration purpose):
boolean printScentenceInMainReport = false
for (Article a : articleArrayList) {
if (a.getArticleNumber() == 420) {
printScentenceInMainReport = true;
}
}
does one of you guys have a solution for my problem ? Is this possible without creating a Scriptlet ? thanks in advance.
Datasource: The reports are linked to a microsoft SQL database. The main and the subreport have their own queries.

How to set sequence number for group in jasper report [duplicate]

This question already has answers here:
How to show the number of Group?
(2 answers)
Closed 4 years ago.
I have a report that is grouped under a particular category. I need to show the sequence number for each group on the group header.i'm using iReport 0.4.1.
The output may be like
seqno:1 group one
seqno:2 group two
Try with the variable $V{REPORT_COUNT}
from the documentation :
REPORT_COUNT which holds the number of records currently processed
See here for related thread
Note : I didn't get how you were grouping records, but you should be able to do the appropriate operation on this variable to get what you want

Japer Reports - How to use a REPORT PARAMETER's value in the WHERE clause of that Report's Query? [duplicate]

This question already has answers here:
How to pass parameters to query?
(2 answers)
Closed 8 years ago.
Say, I have a simple report with a data-source setup. I'm going to embed the report in a Java application. In that application the user gives a specific input. That input would get passed into the Report as a parameter. Based on that parameter the report's query should generate results. How this can be achieved ?
Eg..
User is asked for input for a SCHOOL_ID,
SCHOOL_ID is passed as a Parameter to the REPORT,
REPORT puts the SCHOOL_ID's value in the SQL query,
(SELECT * FROM Students WHERE SchoolID=$R{SCHOOL_ID};) <---
( $R{SCHOOL_ID} is the report parameter here)
Dynamic results are generated.
Can this be done ?
Any tutorials ?
The query will be like this
SELECT *
FROM Students
WHERE SchoolID=$P{SCHOOL_ID}
We $R{} for text field expression and $P{} for parameter. If you develop this query in iReport then just drag the parameter from list of parameters where you want to add in query.
To create a input control:-
1:- Open Query executor in iReport.
2:- Add new parameter -
Parameter Name:- SCHOOL_ID
Value expression:- Text(if it is string)
Default value expression :- "ID01" (if its a ftring use "")

Crystal report multiple date count

I am trying to create a crystal report chart that counts the number of opened and closed tickets of each month.
Example they opened 10 tickets but 15 were close (7 from the same month 8 from other months).
When I try to generate the report I can get either the open or the closed working. I know the problem is with the grouping (if grouped by the submitted date the submitted date is right but the closed is wrong because of ones from other months and vis-a-versa).
I have tried overlapping the reports but the problem with that is the auto scale could be different for the reports and fixed scaling is not an option.
Because the data is filtered to return all rows with a submitted date or a closed date is greater than one year ago. I use a sum to count the records
example:
if submitted > 1 year ago
1
else
0
same for closed
For the display I need a bar chart where the two groups are sorted by the month. One bar for the ones opened in that month and one bar for the closed of that month.
Similar situation but I can't modify the sql.
One record in multiple Groups within Crystal Reports XI
I'll offer my solution based on years of wrestling with Crystal.
Do your data processing in the database (stored procedures) or core application (C# or whatever), then hand off a simple table or two to Crystal.
This makes your reports lightweight and easy to maintain (or move to another reporting tool later on) and puts the "guts" of your logic in plain code that can be managed in source control.
I'm sure you could get it to work in Crystal, but next month you will forget how it works and your coworkers will be even worse off. Let Crystal do basic formatting and render a pretty report, but do the hardcore data processing elsewhere.
Spend an hour feeding Crystal simple data rather than spending an hour configuring 5-level-deep options in the Crystal designer.

Dynamic Columns [duplicate]

This question already has answers here:
How to show/hide a column at runtime?
(8 answers)
Closed 5 years ago.
I need to create a report where the number of columns changes based on the data being passed to iReport just like with a subreport. Is there a way to do this?
I agree with Ischin's answer, but I will elaborate.
The Crosstab Report will allow you to have dynamic columns because it allows you to pivot your data. You can select one or more fields to group by to create the columns. The values of the groups become the labels for the columns and then you must use aggregate functions for the values in the report called Measures (e.g., sum or count). If you select more than one field, you will have multiple levels of columns. When you design the report, you pick the size of the columns--they must all have the same size.
JasperReports is a product designed for creating something that will print on a piece of paper consistently, like a PDF. iReport as of at least version 5.1.0, does not have any other way to truly dynamically create columns. You could write in logic to show or hide columns based on parameters, but this would be very tedious and does not fit in with what JasperReports is designed for. It would be very difficult, for example, to allow the user running the report to select parameters that allow the user to control which columns are in the report and the positions of the columns.