Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula (Count number of row using a condition) Post Reply Post New Topic
Author Message
awhawh
Newbie
Newbie


Joined: 31 Jul 2008
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote awhawh Replybullet Topic: Formula (Count number of row using a condition)
     Posted: 08 Aug 2008 at 1:07am

Can someone please advise me on a problem I'm having with a formula field

First of all, I created two formula fields to work out the "target days to completion" and "actual days taken" for a workflow process.

Below are a list of fields that make up each row of the report:

Process name,   Start date,   Expected end date,   Completion date,   Target days to completion*, Actual days taken**


* Derived from the start date and expected end date (ignoring weekend days)
** Derived from the start date and completion date (ignoring weekend days)

What I would like to do is to create another formula field to count the number or processes that missed the target (i.e.  "actual days taken" > "target days to completion") using the above two formula fields. This can then be placed at the end of the report, in the report footer. (Unfortunately, I can't produce a running total using these two formulae)

I created the following formula, but the only value returned is a boolean. I'm not sure where I'm going wrong, so I would be very greatly for help.

WhilePrintingRecords;
local numbervar MissedTarget;

while {@Actual 1} > {@Target 1} do
(
    MissedTarget = MissedTarget+1;
    exit while
)


Thank you

Adam

IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 08 Aug 2008 at 3:24am
Try
 MissedTarget := MissedTarget+1;
You need := to make an assignment, = on its own is a boolean comparison
IP IP Logged
awhawh
Newbie
Newbie


Joined: 31 Jul 2008
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote awhawh Replybullet Posted: 08 Aug 2008 at 6:28am
Thanks for this. I've managed to retrive a value, but at the moment it only returns 1 and doesn't appear to loop through all the records and return the true number
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