Print Page | Close Window

Count certain fields

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=269
Printed Date: 03 May 2025 at 12:13am


Topic: Count certain fields
Posted By: jonathan
Subject: Count certain fields
Date Posted: 01 Mar 2007 at 9:52pm
I have a report that displays a list of cars.
Some are for sale, some are on hold, some are sold... etc

car 1       Sold
car 2       Available
Car 3      sold
Car 4      under finance
...
...
Car 1      Available

All I want at the end of my report is
n car sold
n car Available

Something like COUNT(carID) WHERE Status='sold' but in Crystal, not SQL.

I'm having trouble returning values. (I'm quite a beginner in CR)

thats it. if someone can help me.Confused


-------------
When 40 million people believe in a dumb idea, it's still a dumb idea.



Replies:
Posted By: BrianBischof
Date Posted: 01 Mar 2007 at 10:48pm
You have to use a formula with Global variables. Just have it add up all the  Sold and Available fields and then display them in the report footer. Something like this:

Global NumberVar CarsSold;
Global NumberVar CarsAvailalbe;

If {Table.Status} = "Sold" Then
    CarsSold := CarsSold + 1
Else
    CarsAvailable := CarsAvailable + 1

Check out my free online chapters on writing formulas for lots more info.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window