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

finding references to a field & group calculations based on all record

Status
Not open for further replies.

voirin

Technical User
May 15, 2003
29
AU
Hi I have a few issues to resolve with crystal reports (v8.5). I was hoping someone could help me.

1. I have a Formula Field that i would like to delete. However when i try and delete it, it says that the field is being used in the report, and to delete it i must remove all references to this field. For the life of me i cannot find any refernce to this field within my report. Is there a way i can find all references to this field?

2. How do I achieve the following... I have a SQL table called AMERICA. I produce a report that has a grouping (based upon State i.e. Utah, California etc..). For each state i want to display statistics as a percentage of the whole of America. Lets take 'population' as one such statistic. How do i create a formula within each grouping (location) that calculates: (#people in Location/# people in all of America). I don't quite know how to incorporate the '# people in all of America' into a grouping... Do I use an 'SQL Expression Field', and how? I know that I cant use a 'Running Total Field' to perform a count of the total population in America, as this is an accumulative count. I don't quite know how to do incorporate the '# people in all of America' into a grouping.

Any help most appreciated!
voirin
 
If you change the unwanted formula field to make it invalid, the report should stop. That should tell you where it was being used.

Likely places are section suppression commands. I also once had a case where a commented-out reference was causing the trouble. I coulnd't recreate the error, since normally they are ignored.

For your second problem, you need summary totals. There are taken from the data, which makes them cruder than running totals, but usable anywhere in the report. You can do a summary total for both the group and the whole report, and then use a formula field to get the percentage. (I think you can also get the summary percentage direct, but I've never done this.)

Right-click on a field and choose Insert to get a choice of Running Total, Summary and Grand Total. Or else use the Field Explorer, the icon that is a grid-like box.

It is also possible to get get totals using a Formula Field, which can contain a Variable or a Directly Calculated Total.

Running totals allow you to do clever things with grouping and formulas. They also accumulate for each line, hence the name. The disadvantage is that they are working out at the same time as the Crystal report formats the line. You cannot test for their values until after the details have been printed. You can show them in the group footer but not the group header, where they will be zero if you are resetting them for each group.

Summary totals are cruder, but are based directly on the data. This means that they can be shown in the header. They can also be used to sort groups, or to suppress them. Suppress a group if it has less than three members, say.


[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
To get the percentage that the state population represents of the total population in America, try:

sum({table.people},{table.state}) % sum({table.people})

-LB
 
Thanks so much everyone! all problems solved :)

V
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top