Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Question on IIF statement.

Author  Topic 

steve4134
Starting Member

24 Posts

Posted - 2011-02-03 : 15:33:34
I thought this was pretty simple. Apparently I fail. What I am trying to say is If my source file = Lifeguard then = 1 if not then 0. I wrote the following

=(iif(Fields!Source.Value="Lifeguard",1,0))


Which in my head says , If my source file = Lifeguard then make Lifeguard a 1 and if it doesn't say lifeguard = 0

Any help would be appreciated.

Steve

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-02-03 : 15:42:34
This is obviously an Access question for a form field or access SQL?

Your syntax appears to be correct. Are you sure your data says Lifeguard? is it case sensitive? are there trailing spaces?

Are you getting an error? or just all 0?



Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page

steve4134
Starting Member

24 Posts

Posted - 2011-02-03 : 15:46:33
No this is in sql 2005. I am using it in visual studio 2005. The source is only Lifeguard and Call......No trailing spaces.

Steve
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-02-03 : 16:03:49
So this is an expression for reporting services then?

Above you said "source file"...is Source a column in your data set?

Have you tried SWITCH? SWITCH(Fields!Source="Lifeguard",1,0)

Not sure what to ask..your syntax is correct.

=iif(Fields!Source.Value="Lifeguard",1,0)




Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page

steve4134
Starting Member

24 Posts

Posted - 2011-02-03 : 17:08:11
So this is an expression for reporting services then?

Above you said "source file"...is Source a column in your data set?

Have you tried SWITCH? SWITCH(Fields!Source="Lifeguard",1,0)

Not sure what to ask..your syntax is correct.

=iif(Fields!Source.Value="Lifeguard",1,0)


Yes the expression is for reporting services. Source is a column in my dataset Correct. That's where I am stuck

Steve
Go to Top of Page
   

- Advertisement -