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)
 Is there a way to call the value of the textbox wi
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

robert693
Starting Member

USA
42 Posts

Posted - 04/21/2013 :  16:59:02  Show Profile  Reply with Quote
Hello,

Is there a way to call the value of the textbox with a function to change the background color in the fill property? 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?

James K
Flowing Fount of Yak Knowledge

3760 Posts

Posted - 04/21/2013 :  17:52:30  Show Profile  Reply with Quote
quote:
Originally posted by robert693

Hello,

Is there a way to call the value of the textbox with a function to change the background color in the fill property? 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?

You should be able to set the Background Color property using an IIF expression. What is the expression you used? Can you post it? The IIF expressions would have to be nested though. An easier approach that I prefer instead of nesting may IIF's is to use the SWITCH construct like below:
=Switch(
	Year(Fields!YourDateField.Value)=year(Today()),"Blue",
	Year(Fields!YourDateField.Value)=1+year(Today()),"Red",
	Year(Fields!YourDateField.Value)=2+year(Today()),"Green"
	)

Edited by - James K on 04/21/2013 18:16:44
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 04/22/2013 :  00:46:36  Show Profile  Reply with Quote
the value of textbox can be referred in SSRS using ReportItems!Textboxname.value

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

robert693
Starting Member

USA
42 Posts

Posted - 04/22/2013 :  08:38:21  Show Profile  Reply with Quote
The value of the textbox does not come from a field but is generated by the function above. There is a row of textboxes each of which have the month and year in sequence starting with the present month that a user generates the report and going up to 14 months out. I need for the months in the current year to be one color, the months in the next year to be another color and the months in the year after that to be another color. I need to know how to call the value of the textbox since there is no field that the data is drawn from.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3760 Posts

Posted - 04/22/2013 :  09:11:02  Show Profile  Reply with Quote
Replace the Fields!YourDateField.Value in my example with the expression that you are using. Or, even better, use what Visakh suggested, i.e., use the ReportItems!Textboxname.Value. The Textboxname, obviously, is the name of the textbox where you have the value displayed.
Go to Top of Page

robert693
Starting Member

USA
42 Posts

Posted - 04/22/2013 :  09:45:54  Show Profile  Reply with Quote
Thank you for everybody's help! The Switch() worked with the "ReportItems!Textboxname.Value" calling the value of the textbox!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 04/22/2013 :  12:06:07  Show Profile  Reply with Quote
quote:
Originally posted by robert693

Thank you for everybody's help! The Switch() worked with the "ReportItems!Textboxname.Value" calling the value of the textbox!



cool
you're welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
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.11 seconds. Powered By: Snitz Forums 2000