SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 SSRS 2008 r2 iff with lookup
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jassie
Constraint Violating Yak Guru

269 Posts

Posted - 10/03/2013 :  14:31:45  Show Profile  Reply with Quote

In a ssrs 2008 r2 report, I have found the following expression and I would like you to explain the following code to me:

=IIF(Lookup(Fields!SK.Value, Fields!SK.Value, Fields!StCount.Value, "DS_StCount") = Nothing, 0, Lookup(Fields!SK.Value, Fields!SK.Value, Fields!StCount.Value, "DS_StCount"))


I know that a lookup function compares the first values to see if they are equal, and if so they value in the third column is returned. However I do not know what this enire
iif statement is doing. Can you explain it to me?

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 10/04/2013 :  01:57:25  Show Profile  Reply with Quote
it checks if the value SK has a valid match in dataset DS_StCount if yes it will return the StCount of the first matching row. otherwise it will return 0. IIF is like CASE WHEN. It checks for a condition and returns two return value one for true part and another for false.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jassie
Constraint Violating Yak Guru

269 Posts

Posted - 10/04/2013 :  09:45:58  Show Profile  Reply with Quote
Thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000