Crystal Report Group Fields Summery in Header? - crystal-reports

I have four groups. I am trying to do an accumulative summation between grownups.
Ex:
group1: A = 140
group2: A = 70
group3: A = 20
group4:
A = 10
group4:
A = 10
group3: A = 50
group4:
A = 20
group4:
A = 30
group2: A = 70
group3: A = 20
group4:
A = 10
group4:
A = 10
group3: A = 50
group4:
A = 20
group4:
A = 30
Here is a snapshot of my real report:
I have tried to using Summerize fields to sum the first level and it worked. I then tried to sum the Summzrize fields, but its not possible to sum those. I tried TotalRunningFields, but they display the results in the footer only. I tried using custom formula, but i wasn't successfully.
Can anybody give me a way of doing this. Also, if an example would be great.

Actually after a while, i tried to think of another way to implement the report. Crystal Report tells you not to do any grouping on the data but makes it hard for you to implement your logic based on grouping.
What i did in th end is that i have created a view, and then created several procedures that selects from this view. Each select have the necessary grouping. After that, i made sure that each select contains the ID's that can implement the hierarchy i want.
I mapped the all procedures and used the SMART Linking feature in the Crystal Report. This relived me from implementing any formulas or any extra logic in the report it self.

Everything is Possible
Create formula fields according to your total groups.
edit each group to:
sum({Filed Name},{DataTable1.Groupname})
Your choice: either you can put in each formula field in respective group OR on footer.
regrds;
AJAY

Normally footers will be processed after processing headers, hence it is not possible to insert summaries in headers.
But there is one way where create a sub report and place it in report header with same design and calcualte all values in footers, Now in main report create the same grouping hierarchy now just pass the sub report values to main report header and show.
Note: this will affect performance as two reports need to run

Related

Hide Column conditionally in crystal report

I have data like below:
**Account Name****Total****Remarks**
Account01 100 Remarks1
Account01 100 Remarks2
Account02 30 Remarks3
Account02 30 Remarks1
Account02 30 Remarks2
Account02 60 Remarks3
Account03 50 Remarks1
Account04 50 Remarks2
How can I create a formula so the result shows as below:
**Account Name****Total****Remarks**
Account01 100 Remarks1
Account02 30 Remarks2
Account02 60 Remarks3
Account03 50
Account04 50
It seems the result shows two parallel blocks of data.
The left block contains the distinct pairs of account name and total.
The right block contains the distinct remarks.
If this is what you want (which is akward, but if this is your business rule...), here is how to get it in Crystal Reports:
Suppress the details section.
In the report header section, put two subreports side-by-side and do their layouts as follows.
In the left subreport, create a group by "account name" and a group by "total".
In the group-by-total header section, put the fields "account name" and "total". Do not use the details section - suppress it. Do not summarize total, just put it there.
In the right subreport, create a group by "remarks".
In the group-by-remarks header section, put the field "remarks". Do not use the details section - suppress it.

How to get individual group totals in report

I have a jasper report being made with iReport, which is basically a list of pages received the day prior. The report has total pages for the whole day and then individual totals for each group of page types.
The requirements state I need to display all the totals above the listed records and groups (ex. display in the title band). I created a variable for the total of all pages and that works but am having trouble getting each individual group total.
It should look like:
Total pages received: 50
Total GROUP_A: 20 Total GROUP_B: 30
When I try to use the variable set up for group totals, it only gives me the last used group, so it would say 30. I'm unsure how to create a variable to get the total for only a specific group.
I could include in my SQL result set the totals but was asked to do it within iReport.
If I understand the problem right you need to put a copy of the variable that you are using in the group and put it in your title band. the trick is on the object in the title band make sure you have set the evaluation time & evaluation group group or report depending on what you are truing to get a total of.

Selectively showing groups in Crystal Reports

I have a report which displays information by group; I'd like to not show any group that doesn't have at least two items in it. Is there an easy way to do this?
Example:
Bob
3/1
4/3
Joe
3/2
3/7
3/9
Mark
5/9
James
John
8/17
9/2
Grouped on name, should not show Mark or James.
If your report is simplistic enough, you can get away with just suppressing the Group Header, Group Footer, and Details sections by using a summary function like count({table.somedate},{table.dudesname}) < 2. Note that the second parameter to a summary function has to be a field being used to group on.
Your mileage may vary with doing it this way. If you are displaying calculated summaries in the report footer, for example, it won't make sense to just suppress these groups as their data will still affect any report-level summary. The other problem you might run into is needing to use a distinct count on some field instead of just a count, depending on your table joins.
You could create a group-selection formula (Report | Selection Formula | Group...):
Count({table.field_to_count}, {table.grouped_field}) < 2

getting grouped records into separate view columns

I have a crystal report with a subgrouping on a field. The output is shown each group-details vertically stacked as follows:
Group Header Value 1
Detail 1a
Detail 1b
....
Group Header Value 2
Detail 2a
Detail 2b
.....
and so on.
What I need to see is the detail values in table columns as follows:
Group Header Value 1 Group Header Value 2 Group Header Value 3
Detail 1a Detail 2a Detail 3a
Detail 1b Detail 2b Detail 3b
Detail 1c Detail 3c
Detail 3d
I've tried formatting the Detail Section with multiple columns along with formatting the group with multiple column, but it's just a mess. I know I will only have at most 4 distinct Group values.
Any suggestions please?
Thanks.
Crystal is not very good at displaying items vertically like that, but here are a couple of options I can think of:
Build up 4 arrays where each corresponds to one of the groups and contains strings that are what you'd like to output for each record (one array element for "Detail 1a", one for "Detail 2b", etc.). You can do this by creating a single formula in your details section that checks the individual records for the group condition and add the values to the appropriate array.
In the report footer, create 4 formulas that output the entire contents of one of the arrays delimited by a newline character. If your arrays contain strings, you can simply use the Join() function to output the whole thing with a delimiter. Make sure those formula fields are set to "Can Grow" and place them side-by-side.
The downside to this is Crystal arrays are limited to 1000 elements, so if you'll have over 1000 records per group, this is a bad idea.
You could make 4 individual subreports for each group and place them side-by-side. I've never tried something like this before, so there might be some quirks that I'm not considering. Generally, though, you should be able to put whatever you want in the subreports and as long as it doesn't grow too large width-wise (you may needle to manually specify a very small page size in the subreports to make sure of this), it should look relatively the same as how you place them in your main report
If I understand the question correctly, you want to implement your report in a format similar to a Pivot table (as can be found in Excel).
The Crystal equivalent of this is call a Cross-Tab - you can add one to your report by selecting Insert>Cross-Tab... . This will bring up the Cross-Tab Expert, which will enable you to drag and drop the fields you want to see down and across the page into the appropriate places.

Is it possible to programmatically iterate through a table within a formula in crystal reports?

Is it possible to programmatically iterate through a table within a formula in crystal reports?
E.G. If I have a master table and a detail table can I iterate through the detail table e.g.
( psuedo code )
local numberVar Total := 0
While not EOF()
IF Type = "+"
Total = Total + Quantity
ELSE IF Type = "-"
Total = Total - Quantity
ENDIF
<Next Record>
End While
It is possible to use loops in a formula field to get the data that you need, but I have only really used them in complex string manipulation. If you really need to do this then you may be able to look into using subreports, but you'd need to put the subreport in the details section which is not really recommended because it is essentially like running a new report for each record that is pulled.
It sounds like what you are really looking for is a running total field. If you join the master and details tables together the report will pull all of the rows for both tables. Then you can group by "Type" and create a running total field that sums the "Quantity" field for each row and resets on the change of the group. I think it is a little different way of thinking than traditional programming. Hope this helps.