Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Count of All strings in a column broken by ; Post Reply Post New Topic
Author Message
achandana01
Groupie
Groupie
Avatar

Joined: 20 Jul 2011
Online Status: Offline
Posts: 59
Quote achandana01 Replybullet Topic: Count of All strings in a column broken by ;
    Posted: 19 Jan 2023 at 6:52am
Hi,

I need to do a total count of all Strings broken down by a ';' in a string, My data looks something like below

DATA:

EMP   DEP
100   A;B;C
200   A; C
300   C

OUTPUT:

DEP COUNT(EMP)
A      2
B      1
C      3

I have put the following formula in the cross tab and do count on EMP however I am not getting the result I am looking for I know if else doesn't work the way I want

@Formula
if DEP like '*A*' then 'A'
if DEP like '*B*' then 'B'
if DEP like '*B*' then 'C'

Thanks
chand
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 01 Feb 2023 at 9:58am
I wouldn't use a cross-tab for this - I don't think it's going to work to count a record more than once. If you don't have a lot of possible values for this field, you would create a formula for each possible value that looks like this:

{@A for Count}
If InStr({DEP}, 'A') > 1 then {EMP}

Then in the report footer, you would list each possible department with a count of its "for Count" formula to get your totals.

-Dell
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.047 seconds.