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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional summary? 1

Status
Not open for further replies.

espltd

Programmer
Apr 6, 2005
233
US
Hi I am using crystal report 10 that comes with vs.net. I have data that I am grouping by and the number can be 0 - 4. In the group footer I would like to place a seperate count on this number for the number of times the number is 1. I would like to do the same for the numbers 2 through 4, so it seems like if I could do a conditional summary it would work.
Thanks Paul.
 
If 0 to 4 are the values of the field you are grouping on, then you can insert a crosstab in the report footer, use the field as the row, and count of the field as the summary.

-LB
 
If you don't want to do a crosstab, running totals can be conditional, based on a formula. If you're not already familiar with Crystal's automated totals, see FAQ767-6524.

PS. It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanks for the information, crosstab sounds like a good idea. yep I probably should have been a bit more specific on the version information other than just stating "I am using crystal report 10 that comes with vs.net" as I think there may be subversions of version 10. I created some formulas to take care of it but will also add a crosstab.
 
Had another question on the crosstab, It looks like it is working but is there any way to instead of displaying 0 through 4 (values that I am grouping on)could I display a string in the crosstab? For example 1 = data entry, 2 = missing data, 3 = old data, 4 = virtual data.
Thanks.
 
In the crosstab expert, select the row field (that results in the numbers)->group options->options->customize group name->use a formula->x+2 and enter:

select {table.number} //your row field
case 1 : "Data Entry"
case 2 : "Missing Data"
case 3 : "Old Data"
case 4 : "Virtual Data"

You might have to refresh the report to see the change.

-LB
 
Use a formula to alias, like so:

SELECT {myfield}
CASE 1:
"Data Entry"
CASE 2:
"Missing Data"
CASE 3:
"Old Data"
CASE 4:
"Virtual Data"
DEFAULT:
"Good Data";

Or, since you are using simple numbers, you can use an array-based solution.

["Data Entry","Missing Data","Old Data","Virtual Data"][{myfield}]

 
Hi thanks for the response. I have one minor issue, as I currently have the table.reasonType (this is the field that is 0-4) set up under columns and have sumerized fields as count of table.ReasonType. I then have location for Rows since there are about 100 locations I aranged it this way so everything fits on less pages. When I have the table.location as a column and the table.reasonType as a row, since there are 100 the cross tab is quite large horizontally and uses several extra pages when exported with only 5 rows per page, 0-4. Not sure if there is a way to use a formula on the column?
 
Why are you raising this as an issue? Why not leave location as row? You can use the group naming option on the column fields, too.

-LB
 
yep you are correct, I found the group naming option on the column field, not sure how I missed it!
thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top