Change groups on new page - crystal-reports

I need to create a summary page in crystal reports where it groups all the details with the same ItemName and calculates the totals
Data Example:
Balls 50
Balls 75
Food 10
Dolls 45
Food 68
On the last page in the report I need it to say
Balls 125
Food 78
Dolls 45
The report is already grouped by another detail, is there anyway to change what the report is grouped by on the last page?

Insert a cross-tab object in the report footer. Use the text field in your example as the 'row' field in the cross-tab. Use the numeric field in your example as the 'summarized' field. Leave the 'column' field blank.

Related

Crystal Reports SUM formula help. Don't SUM values with specific IDs

I have a table with rows of Invoice data and I want to SUM the values of all line items where the Item ID is not equal to 0000 or 9999.
The Item IDs I want to exlcude 0000 and 9999 never change.
ITEM ID
NAME
WORK VALUE
TOTAL COMPLETED
0000
HOLD 1
0.00
1,234
1234
MATERIAL A
333.00
76.00
1235
MATERIAL B
567.00
7043.00
1236
MATERIAL C
981.00
321.00
1237
MATERIAL 4
430.00
5445.00
1238
MATERIAL 5
10.00
897.00
1239
MATERIAL 6
18.00
654.00
1240
MATERIAL 7
882.00
3.00
1241
MATERIAL 8
777.00
65.00
9999
ZY HOLD
0.00
111.00
So the value returned in the report from the example above should = 18,502.00 not 20,847.00
I have tried:
IF NOT((TONUMBER({Invoices.InvoiceItems~ItemNumber}) = 9999))
THEN
(SUM({Invoices.InvoiceItems~InvoiceValue})+SUM({Invoices.InvoiceItems~TotalCompleted}
but this doesn't work, it still sums the value from the 9999 line item
I would create a Running Total Field to accomplish this.
A Running Total Field works very similar to the Summary Field, but allows a lot more control over which records are evaluated when summarizing the data. To setup a Running Total Field for your needs try the following steps.
Create a new Running Total Field.
Set the "Field to summarize" to use the Total Completed column from your database. Set the "Type of summary" to SUM.
Set the radio button in the "Evaluate" section to "Use a formula", then click the X-2 button to create the formula that will determine if a row of data should be included in the sum or not. Whatever formula you enter here will need to return a boolean value. When this value is TRUE, the row's data is included, and when it's FALSE the row's data will be excluded. I would use the following formula here: TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 9999 AND TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 0000
The last thing to do is the setup the Reset conditions for the Running Total Field. This would be used if you were grouping data in some fashion such as by Customer and would allow you to sum the data for a single customer, then reset to zero for the next customer. If you are not using any grouping you can probably just leave this set to "Never".
Click OK to finish. :)
At this point all you need to do is drop the Running Total Field you just created into your report. Be mindful about which sections you place this field within though. If you place it in a header section, you will likely find it doesn't add in the last record in your dataset because the report hasn't printed it to the details section yet. I recommend placing Running Total Fields in Footer sections to avoid this nuance.
I hope this helps! And if you do have some grouping levels that you need help with setting the reset conditions just let me know what the grouping levels are for your report and I can update this answer for you.
You can create a new formula similar to yours:
IF TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 9999
AND TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 0
THEN {Invoices.InvoiceItems~TOTALCOMPLETED}
ELSE 0
and then just sum this formula field up.

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.

Getting data on a single row

I have a stored procedure that return the data as shown below. There is 3 rows of information for evey company. I am trying to design a crystal report to display the data on a single row as shown below under Desired Output.
How can this be done ?
Loc facility ARtype days Revenue PPD
140 Company ABC MCD 1724 4000 137.76
140 Company ABC MRA 218 8000 327.69
140 Company ABC MPD 85 7000 166.84
Desired Output
140 Company ABC MCD 1724 4000 137.76 MRA 218 8000 327.69 MPD 85 7000 166.84
group by revenue and place your field in detail where you get individual record.
Now use the below formula.
Shared StringVar a;
a:=a+<<Database field>>;
Place the above formula beside the database filed in detail and supress
Now create another formula
Shared StringVar a;
a;
Place above formula in group footer.
Edit:
Create another formula reset
Shared StringVar a;
a:=" ";
Place this formula in group header and supress the formula as this not of user importance.
You can use below simple steps,
1] Assuming you are putting your data in detail section, go to Section Expert of detail section and check the checkbox having label Format with Multiple Columns
2] This will print your data the way you are expecting. For additional formatting, you will find layout tab generated once you check the checkbox. In that layout you can set the width of detail lines as well as gaps between lines etc.
I hope this helps!

Summarizing each subgroup in Group Footer - Crystal Reports

I'm trying to work on a report for a client. Basically I need something like such
Group 1: Customer ID
Group 2: Truck ID
CustID Vehicle ID Detention Time
------ ---------- --------------
ABX 100 60
35
20
TOTAL: 115
200 80
15
TOTAL: 95
300 10
TOTAL: 10
TOTALS FOR CUSTOMER ABX
100 115
200 95
300 10
Is there anyway to accomplish this without a subreport? I was hoping for a "summary field" that I could summarize more than just a single value.
Thanks!
(FYI using Crystal Reports 2008)
Use a crosstab; place it in the report-footer section.
There might be a better way to do this, but the one that comes to mind is to use two arrays: One to store the truck ID and another to store the corresponding total. In each inner grouping (TruckID), just tack on another array element and store its total time. To display, you could cast the values to strings, attach a newline character after each entry, and set the field to "Can Grow". So altogether, you'd need three formulas: one to initialize the arrays (in GH1), one to update the arrays with sum({truck.time},{truck.ID}) (in GF2), and one to display each entry (in GF1).
With that being said, CR has terrible support for containers... You're limited to 1-dimensional, non-dynamic arrays that are gimped at 1000 items max. It doesn't sound like these would be big problems for what you're trying to do, but you will need to redim preserve the arrays unless you know ahead of time how many trucks you'll have per customer.

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.