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

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.

Related

Jasper Reports - Exporting excel file with multi-sheet reports [duplicate]

This question already has an answer here:
Jaspererports iReport: split report into several excel sheets on export
(1 answer)
Closed 4 years ago.
I was trying to make a jasper report that when exported as an excel file, it will generate different reports for each sheet
the idea would be:
1. sheet 1 = Invoice report
2. sheet 2 = Sales details report
4. sheet 3 = Summary report
Many thanks and best regards,
Ron
set the net.sf.jasperreports.export.xls.one.page.per.sheet property to true
<propertyname="net.sf.jasperreports.export.xls.one.page.per.sheet" value="true"/>

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

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.

SubDataSet in iReport [duplicate]

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

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.