Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If [Action]="Send" Then "Yes" ElseIf [Action]="Resend" Then "Resend" Else "No"

The above condition "Action" is column consist of two values like "Send" and "Resend" if both the values are not their in db then i need to get value as "No" in the report.
Ex:
Send = Yes
Resend = Resend
Null or No value = No

please advice what expression should i need to give to get correct solution as per my example.

What I have tried:

I have with this expression =IIf(Fields!Action.Value = "Send", "Yes", "Resend")
Posted
Updated 13-Nov-18 22:04pm

1 solution

The construct you are looking for is CASE (Transact-SQL) | Microsoft Docs[^]

e.g.
SQL
SELECT CASE WHEN [Action] = 'Send' THEN 'Yes'
            WHEN [Action] = 'Resend' THEN 'Resend'
            ELSE 'No' END

[EDIT] SSRS can use IIF[^] which can be nested e.g.
VB
= IIF([Action] = "Send", "Yes", IIF([Action] = "Resend", "Resend", "No"))
 
Share this answer
 
v2
Comments
Member 14053897 14-Nov-18 4:20am    
This can be used in SQL query but in Report Builder of reporting services i need to have expression to use as per condition.
CHill60 22-Nov-18 7:35am    
My apologies (again) - notifications have just been fixed. I've updated my solution with the SSRS function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900