Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Count of text values in varchar field Post Reply Post New Topic
Author Message
McDowell
Newbie
Newbie


Joined: 13 Oct 2010
Location: United States
Online Status: Offline
Posts: 2
Quote McDowell Replybullet Topic: Count of text values in varchar field
     Posted: 13 Oct 2010 at 10:45am
CR Beginner here and I hope someone can explain how to do this.
 
I have a varchar field: workorderdetails.userdefined2
 
That field will contain one of three values: New, Repeat or Repeat w/ Changes
 
I need to count on how many times each of those values appears in the details of a given work order. Ex: a work order has 10 items in the details, 5 new, 3 repeat and 2 repeat with changes. I'm trying to count one at a time, so I'll be vcreating 3 formulas. One that came back with a number 5 for the new, one that came back with the number 3 for repeat, etc...
 
Any ideas? Thanks in advance for any help possible.
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Oct 2010 at 11:32am
group on work order field
you can do variable formulas to count
you can do Running totals to count
you can create formula fields to convert to numbers and do sums
youc an use a crosstab but this will omit if there are no values of one type
 
I prefer running totals if you need to always show all 3 values, a Crosstab if it does not matter.
you need to create 3 RTs
first one name=New
field to summarize=userdefined2
type=count
evaluate=use a formula
workorderdetails.userdefined2='New'
reset= on a group (select work order group.
place in group footer (RTs do not work in headers)
 
the other 2 are exactly the same but have different evlauate formulas
workorderdetails.userdefined2='Repeat'
workorderdetails.userdefined2='Repeat w/ changes'


Edited by DBlank - 13 Oct 2010 at 11:32am
IP IP Logged
McDowell
Newbie
Newbie


Joined: 13 Oct 2010
Location: United States
Online Status: Offline
Posts: 2
Quote McDowell Replybullet Posted: 13 Oct 2010 at 11:41am

It figures, the design of the report is that the fields are in the header.

I'll give the formula to convert to number and then count.
 
Thanks!
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Oct 2010 at 11:43am
you will need to create 3 and do a SUM on each...
 
if workorderdetails.userdefined2='New' then 1
 
Counting would still count the "" values so you cannot use that process.
 
Note a Crosstab can go in a header if you do not need to show zeros.


Edited by DBlank - 13 Oct 2010 at 11:44am
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