• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 495
  • Last Modified:

Changing output of IIf statement in SQL from -1,0 to a text value

Hello, I have the following nested IIf statement:
New Reviewed Item: IIf(([PPopulation] And [DDesign1] And [O1Outcome1]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And [SP_YN]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And Not [SP_YN] And ([NTotal]>=100)),True,False)))

Open in new window


which works very well and gives me the value -1 for true and 0 for false.  Instead of these values I would like to get the code INC for -1 and EXC for 0.  Can anyone show me how to modify this statement to get this effect?

Thanks so much,
Bevo
0
Bevos
Asked:
Bevos
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
try this

New Reviewed Item: IIf(([PPopulation] And [DDesign1] And [O1Outcome1]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And [SP_YN]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And Not [SP_YN] And ([NTotal]>=100)),"INC","EXC")))
0
 
sshah254Commented:
Just put the whole IIf in another IIF statement ...

IIf(oldstatement = true, "INC", "EXC")

Ss
0
 
BevosAuthor Commented:
Hi Capricorn, when I try that statement I get -1 still for true values and #Error when the value is 0.  The SQL code is accepted by the program however without error.
0
 
BevosAuthor Commented:
That worked sshah :) thanks so much both of you for your comments.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now