Jasper Subtotal - jasper-reports

I have a report- from another question: Jasper report data summary which shows totals for a number of columns by location. I need to sub-total some of the location_cds and am not sure where to start. I have one group - by location_cd. Some location_cds have sub-locations, i.e. 3A has 3A1, 3A2, 3A3. Right now I have the totals for each individual row displayed in the group footer. I would like to see a subtotal for any location_cd that has sub-locations. I am trying to puzzle out how I am going to approach that. Should I see if I can do that in the query or will Jasper help me out here?
I am querying Sybase ASE 15.7.0 and am using Jasper Studio 5.5.1

Sub totals are the same as totals, just check the following:
add the order by corresponding to your list - usually add the item to the order by list
ORDER BY some_name_wharever, my_subtotal_thing_to_be_ordered
create a new group using the wizard, right click the root of the report on the report inspector and select "add report group"
create a new variable just like the total one but mind the reset and increment group
That should do it. Hope it helps. Good luck.

I feel like you are trying to create a crosstab, with different subtotals and a general total... Do try looking into crosstabs.. they may be tricky to use, but the end result is great if used properly!

Related

How to repeat table in jasper report based on grouped data from SQL

This is the output from my SQL query
I am trying to create a report in Jasper Studio which will create a separate table for each city.
Right now, what I have created is something that looks like below. It shows all the data with the City listed as St. Louis. What features in Jasper will allow me to do as above?
Finally figured this out.
Create a group band for your report in Jasper. (Right click report Outline-> Create Group)
Next you have two options - create group from a report object or create group from expression. I used the first option and selected City from the list of group objects displayed. Click Next.
Selected the checkbox Add the group header and click finish.
The other change I did was - Previously my headers were under column header, I moved them under the new band group header. Now it works exactly like how I wanted.

Crystal Report how to change the display order in a group

I have a crystal report like below image:
The report is group by "Quot No.", by default it's ordered by "Times Used" (8th column)
How can I change the ordering so that it will order by "Total amount"?
The total amount is a field in the report which is the sum of a field named "quotamt" in the datasource:
I've tried looking in the change group options, took a look at the "Use a formula as group sort order", but the formula only provides three options (ascending, descending, original order), and is unable to sort by another column
The desired result is:
How can I do that?
What I suggest, rather than doing this task in crystal report, good to done at sqlserver side means database side.
This is simplest suggestion when you have this type of situation.
You can give the condition on sqlserver side too. and get the data order same as you want.
Yes, this can be done in report side, but it take time for this.
Don't use formula as group sort order instead from the dropdown use Specifed Order and in the window specify the order you need

How to use Details band to display multiple data sets

I have a JasperReports's report with 10 rows fetched from the main query..
When i run the report it will show 10 rows without a problem.
Now when i add another band with fields of a data set in a list item. It is repeated for every record in the main report!. :(
How can i avoid this situation and change the second details band to print when the main report data has finished printing on the first band?
I would want to achieve this without going for sub-reports as it's difficult to maintain many files for a single report.
I have learned a lot on jasper reports over time and I'm posting the answer for my very own question to help someone in future.
What you need to do is for complex, Multi-query reports you create the main report with a simple query like this.
SELECT SYSDATE FROM DUAL
What this means is that when it's run main report details band will have a single iteration. That means if we have used the SYSDATE field in the details band it will print once.
OK, now if you follow the following steps you should be able to achieve the above task successfully.
Add two details band to the report (you must be having one details band by default, to add another right click --> add another detail band)
Add two data-sets to the main report (right click on the report and select Add Dataset)
Now all you need to do is use those two data sets in the previously created details bands by using either a list item or table item (personally I would recommend table as you can do lot of advanced stuff in that)
Hope this will help someone in the future. let me know if you need more help!. Cheers!!

Crystal Reports Group Header edit

I'm trying to figure out how to change or edit Group Header titles in Crystal Reports. Group Header title is pulled from sql and I only have two Group Headers and it's the second one I need to edit. It reads SEP which is pulled from data table, but for reporting purpose I'd like it to read Separate Accounts. Group Headers are not text objects, so I don't know how to edit. Thanks.
click on the group Tab then Properties
so you can change the name
What version of Crystal Reports are you using? Exactly how do you want to edit the titles?
In the grey area of the designer, right click on the group you want to edit, select change group and look for 'Customize Group Field Name'. Depending on what version (I am looking at Crystal 2011 right now), you can choose another field or Use a Formula as a Group Name. I think that the latter should suit your needs. Create a formula (you will have to know how to use Crystal formula logic) to modify/append your groupname tiles.
Alternatively, you could make title changes in the SQL itself using SQL functions, CASE statement, etc.
I hope this helps

Jasper Report group subreports using columns

I have a master report (using iReport 5.0.4) with a subreport that uses grouping by a field called "Group Number" (sorry, but that is the actual column name).
My report works fine when there are more than one group, but it generates each group result scrolling down the page vertically.
I would like to be able to have each group go across vertically, but when I tried using columns, it simply forces each group's data into columns, and not the entire group 1, followed by group 2 in the next column, etc.
There can be up to 8 groups, so I was hoping not to have to create 8 individual sub-subreports with a "print when" expression to show/hide them.
Can anyone tell me if this should be possible?
Thanks,
Mitch
I think making subreports is the easiest and obvious way. But if you want to make it in other way, I can only suggest to use scriptlet, and form dataset manually (Transpose it).
Another suggestion is when you generating report directly from database (i.e. passing connection into jasper) you can modify query and transpose the data (PIVOT table).
Anyway provide more info about your case. I will try to help you.