Solved

iif condition in ssrs

Posted on 2010-09-23
9
3,201 Views
Last Modified: 2012-06-27
Hi,
I have used the following expression in ssrs

=IIf((Fields!ASSET_ID_.Value) LIKE ("*LAB*","*SIGNUP*", "*QDISPLAY*", "*PUB*"),
"Public",
IIf(Fields!DEPARTMENT.Value = "Library"
AND (Fields!ASSET_ID_.Value) LIKE ("*LAP*"),
"Public","Not Public")

and it is giving the error
the value expression for the field ('=IIf((Fields!ASSET_ID_.Value) LIKE ("*LAB*","*SIGNUP*", "*QDISPLAY*", "*PUB*"),
"Public",
IIf(Fields!DEPARTMENT.Value = "Library"
AND (Fields!ASSET_ID_.Value) LIKE ("*LAP*"),
"Public","Not Public")
[BC30198]') expected.


Please help me!!
0
Comment
Question by:Mounikaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 

Author Comment

by:Mounikaa
ID: 33748941
Hello..

Is there any bode to help me!!!!
0
 
LVL 6

Expert Comment

by:CRJ2000
ID: 33749749
Is it possible that you're running into problems with null values? Try putting a test for IsNothing before everything else.... For example:

IIF(IsNothing(Fields!ASSET_ID.value),"Nothing",IIF(...

Chris
0
 

Author Comment

by:Mounikaa
ID: 33749944
The following expression worked for me.

=IIf((Fields!ASSET_ID_.Value) LIKE  ("*LAB*") AND (Fields!ASSET_ID_.Value) LIKE  ("*SIGNUP*")
AND (Fields!ASSET_ID_.Value) LIKE  ("*QDISPLAY*") AND (Fields!ASSET_ID_.Value) LIKE  ("*PUB*"), "Public",
IIf(Fields!DEPARTMENT.Value = "Library"
AND (Fields!ASSET_ID_.Value) LIKE ("%LAP%"),
"Public?" , "Not Public"))

But is there any simple way to do this.
0
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

Author Comment

by:Mounikaa
ID: 33749949
for all reesults I got "Not Public"

I don't know whether workin ina right way or not
0
 
LVL 6

Accepted Solution

by:
CRJ2000 earned 250 total points
ID: 33750018
Your latest has "%" as the wildcards, rather than the "*" that may be causing your issue with the "Not Public" always appearing. To check if your query is working correctly, make sure to pull back the Asset_Id field along with your calculated field.
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 33750029
try this please :

=IIf((Fields!ASSET_ID_.Value) LIKE  ("*LAB*") OR (Fields!ASSET_ID_.Value) LIKE  ("*SIGNUP*")
OR (Fields!ASSET_ID_.Value) LIKE  ("*QDISPLAY*") OR (Fields!ASSET_ID_.Value) LIKE  ("*PUB*"), "Public",
IIf(Fields!DEPARTMENT.Value = "Library" AND (Fields!ASSET_ID_.Value) LIKE ("%LAP%"),
"Public?" , "Not Public"))

But one question, do we not use % along with the LIKE everwhere in your query as similar to how you have to used in "%LAP%"

i am not sure, whether the below can be right... we need to use % as the wild card matching operator with LIKE..not sure why you had used * for some and % for only one. Test it out.

IIf((Fields!ASSET_ID_.Value) LIKE  ("%LAB%") OR (Fields!ASSET_ID_.Value) LIKE  ("%SIGNUP%")
OR (Fields!ASSET_ID_.Value) LIKE  ("%QDISPLAY%") OR (Fields!ASSET_ID_.Value) LIKE  ("%PUB%"), "Public",
IIf(Fields!DEPARTMENT.Value = "Library" AND (Fields!ASSET_ID_.Value) LIKE ("%LAP%"),
"Public?" , "Not Public"))

Thanks
0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 250 total points
ID: 33750036
if * is the wild card character which needs to be used in SSRS then replace the % with * in all the occurrances in the given query and give it a try.
0
 

Author Closing Comment

by:Mounikaa
ID: 33755418
Your comments helped me and I got a result.
0
 
LVL 6

Expert Comment

by:CRJ2000
ID: 33755559
Glad I could help, Mounikaa.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
plsql job on oracle 18 109
Moving Oracle Database to other server 2 47
replicate in oracle 13 45
Section based report in SSRS 14 33
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question