October 20, 2011 at 1:44 pm
Hi everyone
I need a little help with the Switch function.
I have a table report in SSRS 2008 which has the following three columns of data:
Agreement Accepted / Date Agreed / Date Entered
Y / 2011-01-01 / 2011-01-01
Y / 2011-01-01 / 2011-01-15
N / 2011-01-01 / 2011-01-01
I want to create a Switch function which changes the background color in the Date Entered field as follows:
If Agreement Accepted = "N" then background color = "Red"
If Agreement Accepted = "Y" AND Date Entered > Date Agreed then background color = "Yellow"
If Agreement Accepted = "Y" AND Date Entered <= Date Agreed then background color = "Green"
The above table would therefore be colored Green, Amber and Red respectively.
Thanks in advance...
October 20, 2011 at 2:13 pm
ByronOne (10/20/2011)
Hi everyoneI need a little help with the Switch function.
I have a table report in SSRS 2008 which has the following three columns of data:
Agreement Accepted / Date Agreed / Date Entered
Y / 2011-01-01 / 2011-01-01
Y / 2011-01-01 / 2011-01-15
N / 2011-01-01 / 2011-01-01
I want to create a Switch function which changes the background color in the Date Entered field as follows:
If Agreement Accepted = "N" then background color = "Red"
If Agreement Accepted = "Y" AND Date Entered > Date Agreed then background color = "Yellow"
If Agreement Accepted = "Y" AND Date Entered <= Date Agreed then background color = "Green"
The above table would therefore be colored Green, Amber and Red respectively.
Thanks in advance...
It is a case in sql.
case when Accepted = 'N' then 'Red' when Accepted = 'Y' and DateEntered > DateAgreed then 'Yellow' else 'Green' end
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
October 20, 2011 at 2:25 pm
Many thanks and cheers for the prompt reply!
October 20, 2011 at 2:29 pm
You are welcome. Glad that got you going again.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply