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

Counter based on a formula Y/N 2

Status
Not open for further replies.

dreman

Programmer
Jan 16, 2002
272
0
0
US
Using CR8:
I have a report grouping salesman based on orders. Some of orders are completed some are not. (Y-completed and N-for non completed). I would like to count how many N's and how many Y's. Please advise. (I tried running total's but no success). thank you.
dré
 
Hi,

I would use some variables:

1st formula:
whileprintingrecords;
if {order_completed} = "Y" then
global numbervar yes_sales := Yes_sales + 1
else
// throwing in "N" just in case there is another possiblity
if {Order_completed} = "N" then
global numbervar no_sales := No_sales + 1

Place this formula on the detail section and suppress it

In your report footer place the following formulas:

Formula 1:

whileprintingrecords;
global numbervar yes_sales;

Formula 2:

whileprintingrecords;
global numbervar no_sales;

This will give you a count of yeses and nos.

alley
 
thank alley I will let you know.
:) Dré
 
Alley:
Yes it worked fine; however how would I init yes_sales and no_sales after printing them. Please advise :) thank you.
 
Sorry Alley
init=initialize or set it to Zero to get the next yeses and nos for the next group in my report.
:) dré
 
Sorry:

In your group header put the following formula:

whileprintingrecords;
global numbervar yes_sales := 0;
global numbervar no_sales := 0;

Place the calculation formula in the details section

place the two formulas that give you the amount in the group footer.

alley
 
Alley:
wow what a response!!!
thanks for the quick response,
one more question: the formula is used in group footer, however I went to the format section but do not know wher the formula to be placed. I tried to place it reset or other section CR error out with 'it has to be a boolean value'
thank again :) dré
 
Alley:
You are a charm :) ;) ;)
ignore my last post. I figured it out.
Thank you very very much. I would have not done it without your knowledge and BIG help.
 
An alternative technique for doing this without variables is to create 2 if-then formulas:

if {order_completed} = "Y"then 1
else 0

Then Add subtotals and grand totals on these formulas. One advantage to this is the subtotals can now be in the Group Header or the Group Footer (variables won't be complete until the GF). Also, any grand totals would require separate variables, but with the formulas you just insert a grand total. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Hi,

If you want further information about this topic or classes a good place to start would be looking at the Crystal Decisions website to see an outline of the courses that are offered around the country.

alley
 
Or, go to Google and search for 'crystal reports training'. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top