Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula for grouping Post Reply Post New Topic
Author Message
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Topic: Formula for grouping
    Posted: 06 Apr 2017 at 1:56pm
Hello I need to write a formula to group diagnosis codes

The diagnosis codes can be 3-5 characters
Example: F21.1 OR F41.25

I want to do this formula in my command statement but not sure how to start it

For instance I need to categorize the diagnosis in the following order:
If they start with F70 - F90 THEN label this range as Mental Retardation

Hope I am explaining myself well
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 07 Apr 2017 at 4:03am
Hi,

You need to use Case statement to group the diagnosis codes like ..

Select (case when left(diagnosis,3) ='F70' OR left(diagnosis,3) ='F90' then 'Mental Retardation' else when left(diagnosis,3) ='F21' THEN 'XXX' SO ON..

Please check case statement syntax in google for your database and write it.

Thanks,
Sastry
Thanks,
Sastry
IP IP Logged
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Posted: 07 Apr 2017 at 6:20am
Perfect! thank you


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.020 seconds.