Solved

iif condition in ssrs

Posted on 2010-09-23
9
3,241 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Introduction In the following article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods ex…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

615 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