Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Can't count properly Post Reply Post New Topic
Author Message
keithrichards
Newbie
Newbie


Joined: 30 Jun 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote keithrichards Replybullet Topic: Can't count properly
     Posted: 04 Jul 2010 at 1:36pm

Hi all,

 

I have the following script which increments by 1 each time a particular vehicle has been into the service department after the specified date. My problem is that If the same vehicle has been in twice after this date I still only want to count it once - where as at the moment my script counts counts each and every instance the vehicle has been in. Not sure if I am using the correct logic construct, but the existing script below nearly gives me what I need. I have added a maximum into the script because if that worked I would get the result I need.

 

Existing Script

 

 

WhilePrintingRecords;

NumberVar CountService;

NumberVar CountReport;

If maximum ({service_Date},{Vehicle_Number}) > Date (2010, 06, 07) then

(CountService := CountService + 1;

CountReport := CountReport + 1)

 

A snapshot of the current result looks like the following,

 

Service Date            Vehicle Number                  Count Service

19.04.2010              6FPAAAJG517840                        1

11.06.2010              6FPAAAJG517840                        2

24.08.2010              ABC12345891111                        3

 

What I am trying to achieve

 

Service Date            Vehicle Number                  Count Service

19.04.2010              6FPAAAJG517840                        0

11.06.2010              6FPAAAJG517840                        1

24.08.2010              ABC12345891111                        2

 

 

Any assistance would be GREATLY appreciated.

IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 06 Jul 2010 at 2:16am
Only thing I can think of is to include a stringvar that stores the Vehicle Number and reference that stringvar as a condition of the incrementation.
|< /\ '][' ( )
IP IP Logged
keithrichards
Newbie
Newbie


Joined: 30 Jun 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote keithrichards Replybullet Posted: 06 Jul 2010 at 4:16pm
Thanks for your reply,
 
Maybe you can help me figure this out. I am using the NthLargest function in a script below and it is not working properly
 
If {RO_DATE}  in Date (2008, 08, 01) to Date (2009, 07, 31) then
NthLargest(1, {RO_DATE},{vehicle_VIN})
 
I am trying to select the highest date where the date falls into the specified date range. Eg based on the above script and the dates below, I would want it to throw out out 04/05/2009.
 
11/03/2008
04/11/2008
04/05/2009
24/11/2009
21/05/2010
 
Thanks again,
 
KR
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2010 at 3:49am
If you did not get the first issue resolved you could handle it pretty easily using a running total.
name=DateCount
Field to summarize=VIN
Type of summary=DistinctCount
Evaluate=use a formula
{service_date}>date(2010,06,07)
Reset=Never
IP IP Logged
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