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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Expression in sql change color
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hbadministrator
Posting Yak Master

120 Posts

Posted - 04/22/2013 :  13:53:44  Show Profile  Reply with Quote
I have to Fields one is an estimate time =Sum(Fields!ettc.Value) ecct1 and the other field is =Sum(Fields!hours_bill.Value) Textbox21

I would like to then take the textboxes and say ecct1 - Textbox21 if greater than 2 then Text Color Red. How would I accomplish this?

hbadministrator
Posting Yak Master

120 Posts

Posted - 04/22/2013 :  14:56:17  Show Profile  Reply with Quote
I got my answer. =IIF((ReportItems("ettc1").Value - ReportItems("textbox21").Value)> "2","Orange", "White")
Go to Top of Page

hbadministrator
Posting Yak Master

120 Posts

Posted - 04/22/2013 :  17:24:05  Show Profile  Reply with Quote
ok I only got part of it lol. How do I get it to say =IIF((ReportItems("ettc1").Value - ReportItems("textbox21").Value)> "-2","Orange", "White") and =IIF((ReportItems("ettc1").Value - ReportItems("textbox21").Value)< "-2","Orange", "White")

So any thing that is over 2 it will show up red and if anything that is less than -2 is orange Anything within that 1.99 range is white.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 04/22/2013 :  17:44:57  Show Profile  Reply with Quote
You should be able to use nested IIF's - i.e., instead of putting "White", put the second IIF. Alternatively, you can use the SWITCH statement, something like this (I don't have BIDS to test, so if there are syntax errors, please overlook
=Switch(
	ReportItems("ettc1").Value - ReportItems("textbox21").Value > -Red
	ReportItems("ettc1").Value - ReportItems("textbox21").Value < -2,"Orange",
	"White"
	)
Go to Top of Page
  Previous Topic Topic Next 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