Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Help With Count function Post Reply Post New Topic
Author Message
veena
Newbie
Newbie


Joined: 22 May 2009
Online Status: Offline
Posts: 3
Quote veena Replybullet Topic: Help With Count function
     Posted: 22 May 2009 at 4:50am
Hi,

I have to design a report to count  Job card nos based on tools and its warranty, ie for a tool how many warranty job cards are there and how many are paid?

if a single tool has both warranty and paid then the count is coming only once in warranty and not in paid and I am using running totals for this...

Pl help me with this ...

Thanks in advance
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 May 2009 at 6:43am
Can you post sample data rows with an example of how you want it to calculate?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 May 2009 at 6:54am
if you are using running totals and it is possible to make it work, DBlank will figure it out for you.
 
Depending on how the data is structured (which is DBlank question) I would use formulas with shared variables to do the counting.  It is more complex than running totals (probably, I don't use running totals because they don't seems as straight forward to me as the formulas) but accomplish the same thing.
 
In general there is a reset formula, that will set your variables back to 0, this I place in the group header (proably the tool for you). There is a display formula that usually goes in the group footer, you would need 2, 1 for warranty, one for warranty and paid (if I understand correctly).  Finally there is the 'tough' formula, the incrementer.  It tends to look something like:
 
shared numbervar warranty;
shared numbervar paid;
 
if {table.warranty}=true then
 warranty := warranty +1;
 
if {table.paid}=true then
 paid := paid +1;
 
""  //to hide the calculations (looks silly with a number floating around.
 
This formula usually goes in the details section of the report.
 
Hope this helps.  Again, if you need help with running totals DBlank is your man, he has helped plenty of others with running totals.
IP IP Logged
veena
Newbie
Newbie


Joined: 22 May 2009
Online Status: Offline
Posts: 3
Quote veena Replybullet Posted: 24 May 2009 at 8:41pm
Hi ,

here is the sample data

Job Card No. Tool No. Warranty/Paid
J1 1111 Warranty
J2 2222 Paid
J3 3333 paid
J4 1111 Paid
J5 4444 Warranty
J6 2222 Warranty


now what the problem is the tool no 1111 and 2222 are under warranty and paid, but when i use running totals it shows only in warranty and not in paid.


I even tried by using shared variable but its showing boolean values like true and false and not the integer one, I am confused ,... Pl help

Thanks in advance
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 May 2009 at 7:28am

Easy solution is to group on Tool No and then Warranty /Paid Field Then do a distinct count of Job No at that level.

If you want to use running totals, group on Tool no,
create one running total for Warranty and another for Paid.
Set Warranty as a distinct count of Job No.
Evualate as a formula: table.warrant/paidfield="Warranty"
Reset at group lelvel 1.
Place on group footer 1.
Do the same thing for Paid RT but change the evaluate formula to ="Paid".
Is this what you are looking for?
IP IP Logged
veena
Newbie
Newbie


Joined: 22 May 2009
Online Status: Offline
Posts: 3
Quote veena Replybullet Posted: 26 May 2009 at 4:11am
Hi
  I used the second method and its working

Thanks a lot
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