22

I am creating a field from tables with our shoretel phone system and i am intergrating reports via SSRS and i need some assisstance with an expression.

=if(Fields!ExitReason.Value 7,
then if (Fields!ExitReason.Value 1,
else if (Fields!ExitReason.Value 0,)))

Definition results should be:

=if(Fields!ExitReason.Value) = 7 then 1 else 0

I am try to get the field to give me 7, 1 else 0. Any assistance would be great.

Thanks, Arron

Pedram
  • 6,256
  • 10
  • 65
  • 87
Arron Robles
  • 273
  • 1
  • 2
  • 10
  • Take a look at http://stackoverflow.com/questions/3551966/how-do-i-write-an-if-else-statement-in-reporting-services-expression-language – LCJ Apr 14 '14 at 13:41

1 Answers1

46

You should be able to use

IIF(Fields!ExitReason.Value = 7, 1, 0)

http://msdn.microsoft.com/en-us/library/ms157328.aspx

Steve Salowitz
  • 1,283
  • 1
  • 14
  • 28
  • I have a field called ta_amount. if the value inside this filed is >100 then it's should be divided by 100 otherwise display "no pound". but my expression gives me a error. =IIf((Fields!ta_amount.Value > 100), ([(Fields!ta_amount.Value)/100]), "No Pound") – asela daskon May 01 '16 at 01:48
  • I know this is old but the answer to @aselanuwan comment is found in this other SO question https://stackoverflow.com/questions/37283287/ssrs-how-to-make-iif-statement-ignore-invalid-values. In summary, IIF doesn't short-circuit, meaning it always evaluates both sides, regardless of the result. – PedroC88 Nov 01 '17 at 22:40