Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Group summary

Posted on 2006-07-20
Medium Priority
631 Views
I have a report with foure columns: Group1, Name1, Status1, and Count1.

The fields are grouped by Group field. So at the end of each group I want to display the Sum for all Count fields for which Status1='L'

I've tried to set the new field to a formula:

Sum ({Count1},{Status1} , "L")

I keep getting an error "A number field or currency amount field is required here" in field Count1.

What am I doing wrong? Or how do I display Sum of all Count1 fields in each Group?
0
Question by:YZlat
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 9
• 6

LVL 28

Accepted Solution

bdreed35 earned 2000 total points
ID: 17148153
You need to create a formula first, then sum the formula:

//@StatusL
if {Status1} = "L"
then {Count1}
else 0

You can then insert a summary off of the formula or create another formula to do so:

Sum({@StatusL},{Group1})
0

LVL 35

Author Comment

ID: 17148281
bdreed35, the source for my report was an XML file where Count1 is a numeric field, but for some reason Crystal Reports do not read it as numeric.

...
<COUNT1>43</COUNT1>
....

I've tried right-clicking on the Group footer, selecting Insert->Subtotal but in the combobox "Insert subtotal for the field" I don't see Count1. What's going on?

Is there a workaround?
0

LVL 28

Expert Comment

ID: 17148901
You can try using this instead:

//@StatusL
if {Status1} = "L"
then val({Count1})
else 0
0

LVL 35

Author Comment

ID: 17148951
but where do I put this code? Keep in mind that I'm a novice with Crystal Reports
0

LVL 28

Expert Comment

ID: 17148995
From the View menu, Choose Field Explorer.
Right click Formulas, choose New.
Give it the name "StatusL" and click Use Editor.
Copy and paste the formula into the editor, and make sure you replace {Status1} and {Count1} with the full names.
0

LVL 35

Author Comment

ID: 17149122
I've done all that. How do I display the value on the report itself now?
0

LVL 101

Expert Comment

ID: 17151691
In the field insertion popup show the formula tab abd drag the formula onto the report just as you do a database field.

mlmcc
0

LVL 35

Author Comment

ID: 17153230
the problem is that the database for my report is an xml file where COUNT1 field is defined in the following way

<COUNT1>43</COUNT1>

and Crystal Reports does not perceive it as an integer
0

LVL 28

Expert Comment

ID: 17153511
Is this the actual data that you see in the field?
0

LVL 35

Author Comment

ID: 17154249
yes
0

LVL 35

Author Comment

ID: 17154255
but Crystal Report reads it as a string "43" instead of an integer 43
0

LVL 35

Author Comment

ID: 17154326
0

LVL 28

Expert Comment

ID: 17154437
This formula should work: (it is the same as I posted yesterday)

//@StatusL
if {Status1} = "L"
then val({Count1})
else 0
0

LVL 35

Author Comment

ID: 17154522
but how do I display Sum({@StatusL},{Group1}) on the report?
0

LVL 28

Assisted Solution

bdreed35 earned 2000 total points
ID: 17154653
Once you have the formula built, go to the the Insert menu in the designer, and choose Summary.
In the Summary dialog, choose the formula as the field to summarize, sum as the type of summary, and the location should be Group 1
0

LVL 35

Author Comment

ID: 17154770
This is great! Thank you!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirementsâ€¦
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearlyâ€¦
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a qâ€¦