cancel
Showing results for 
Search instead for 
Did you mean: 

Formula to pull diagnosis codes

cothmer
Participant
0 Kudos

We have a report that we cannot get a formula to work, the report needs to pull where it looks at the first set of codes and then the second set of codes. We are using the 'and' statement and it seems to be ignoring the second set of codes, here is an example:

if code in ["z37.0" to "z37.5"] or code in ["z37.50" to "z37.54] and

code in ["072.0" to "07.2"] then true

The report seems to be ignoring the "072.0" to "07.2" statement as we are getting all of the patients that match the first set only.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

DellSC
Active Contributor
0 Kudos

Also, you need to think about how you want the data processed so that you can use parentheses to force the processing order.  For example,

code in ["z37.0" to "z37.5"] or (code in ["z37.50" to "z37.54] and

code in ["072.0" to "07.2"] )

will return different results than

(code in ["z37.0" to "z37.5"] or code in ["z37.50" to "z37.54]) and

code in ["072.0" to "07.2"]

You should also avoid using "if" statements in the Select Expert - frequently they will not be passed to the database, causing Crystal to pull all data into memory and filter it there.  This can cause significant slowness in the report.  However, if you use the format that Abhilash and I provided, the filter formula will be pushed to the database where it can be processed more efficiently.

-Dell

cothmer
Participant
0 Kudos

You mean in a command, correct ?

DellSC
Active Contributor
0 Kudos

Or even in the Select Expert if you're just joining tables without a command.

-Dell

abhilash_kumar
Active Contributor
0 Kudos

Hi Curt,

I'm not too sure if this statement would ever evaluate to true:

code in ["z37.50" to "z37.54] and

code in ["072.0" to "07.2"]

-Abhilash