Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Count certain fields Post Reply Post New Topic
Author Message
jonathan
Newbie
Newbie
Avatar

Joined: 01 Mar 2007
Location: Australia
Online Status: Offline
Posts: 1
Quote jonathan Replybullet Topic: Count certain fields
    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.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.