Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested IIF statements 1

Status
Not open for further replies.

ericb1

Programmer
Oct 22, 2004
175
US
I know, I don't like nested IFF statements either, but I inherited an access97 db from someone and I'm trying to convert some of the reports to Crystal10

This works fine in Access, but returns nothing in Crystal:

IIf({Claims.Pleural_Effusion_Number}="M",10,(IIf({Claims.Pleural_Effusion_Number}="S",5,0)))

It should be that if it returns "M", it will display "10", if it doesn't return "M", but returns "S", it will display "5", and if it returns neither "M" nor "S", then it will display "0"

I even tried writing it out as an IF THEN statement, but it still displays nothing, no errors either.

Any help is greatly appreciated, thanks!
 
How about Select

Code:
Select {Claims.Pleural_Effusion_Number)
Case "M":
  "10"
Case "S":
  "5"
Default:
  "0"
 
Strangely, it still displays nothing. Not sure why. I can browse the data and see M or S, so I know what's in there. And the default or Else statements should give me the 0 if there's something else or null.

Thanks!
 
If you have to handle nulls, then

Code:
if isnull({Claims.Pleural_Effusion_Number)) then
  "0"
else if {Claims.Pleural_Effusion_Number) = "M" then
  "10"
else if {Claims.Pleural_Effusion_Number) = "S" then
  "5"
else
  "0"
 
Thanks! That was it, I was missing the null. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top