Print Page | Close Window

Formula for grouping

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22285
Printed Date: 27 Apr 2024 at 2:42pm


Topic: Formula for grouping
Posted By: sanchezgmc06
Subject: Formula for grouping
Date 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



Replies:
Posted By: Sastry
Date 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


Posted By: sanchezgmc06
Date Posted: 07 Apr 2017 at 6:20am
Perfect! thank you





Print Page | Close Window