Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie question - categorizing by ID

Status
Not open for further replies.

pwobus

Programmer
Mar 22, 2001
3
US
I need to create a report that looks like this:

ID survey1 Survey2

1102 23 16
1108 12 18

Total: 35 34


Here is the formula I'm using to calculate the numbers for survey1:

WhileReadingRecords ;
NumberVar Survey1 ;
Survey1 := if {tblInstrumentMailReceipt.instrNum} in [18, 19, 20, 21]
and {tblClass.classID} = 1
then Survey1
else 0;

Similarly here is the formula to calculate the numbers for survey2:

WhileReadingRecords ;
NumberVar Survey2 ;
Survey2 := if {tblInstrumentMailReceipt.instrNum} in [14, 16, 23, 26]
and {tblClass.classID} =1 then Survey2
else 0;

I am using "running total" wizard to calculate TOTALS by summing the values of "survey1" and "survey2" and then evaluating and reseting whenever the ID field changes.
I am putting the result in the group headers.

Its not working however! Can someone help?

 
You are doing it the hard way. These can be simple conditional totals, described in FAQ 1.B. You don't need any variables or running totals or resets. Add 2 formulas like:

If {tblInstrumentMailReceipt.instrNum} in [18,19, 20,21] and {tblClass.classID} = 1
then 1
else 0

Now create a subtotal and grand total of this formula field (Insert Subtotal/Grand Total). Repeat for the other column.

Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top