April 19, 2013 at 2:26 pm
Hello,
I have a report with a series of textboxes. The value of the textboxes is based on the month and year in regards to the present. Each has a function in the value, the first textbox has: =MonthName(Month(Now()))&" "&Year(Now()) and gives the present month and year. Each of the following textboxes has a function similiar to: =MonthName(Month(DateAdd(DateInterval.Month, 1, now())))&" "& Year(DateAdd(DateInterval.Month, 1, now())) increasing the number of months up to 14 months in the future, i.e. April 2013, May 2013 etc.. For each textbox I would like to have the fill color based on the year shown in the value. For this year it would be blue, for next year it would be red, and for two years in the future, it would be green. I tried to do this with IIF() functions and other ways but it does not work Is there a way to do this?
April 19, 2013 at 2:43 pm
not an SSRS expert, but i certainly know html and css.
if you can set the class of each option in the select list, you can do it:
a css example:
http://stackoverflow.com/questions/2720532/html-select-dropdown-list-with-multiple-colours
and here is a SRS specific link to the one post on how to do it:
Lowell
April 21, 2013 at 8:20 am
There is no way to call the value of the textbox with a function to change the background color in the fill property?
April 21, 2013 at 10:53 pm
Using the IIF statement should work for you. The expression for BackgroundColor is the one to use. A value something like the following should work
=IIF(Fields!Year.Value = Year(Now()), "Green", IIF(Fields!Year.Value = Year(Now()) + 1, "Yellow", "Red"))
April 22, 2013 at 6:31 am
Thank you for your help but the value of the textbox comes from a function, not any field. For example, the textbox that will have the month and year four months ahead is =MonthName(Month(DateAdd(DateInterval.Month, 4, now())))&" "&Year(DateAdd(DateInterval.Month, 4, now())). I don't know how to call just the value of the textbox.
April 22, 2013 at 7:12 am
You can use Reportitem.TextBox1.value to get the value of the text box(named textbox1) then use it a IIF expression like Happy cat suggested.
alternatively you could take your formula that you use in the the text box and make it into a calculated field then use that in the IIF expression.
April 22, 2013 at 8:41 am
Thank you!
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply