"The Color expression for the textrun 'StatusSummary.Paragraphs[0].TextRuns[0]' contains an error: [Bc30518]: overload resolution failed because no accessinle '=' can be called with rhese arguments"
- 42 gets me an error '-' not a valid expression and a syntax error for Today() and Now(), how could i fix these problems?
Member
10 Points
55 Posts
SSRS Expressions, Font Colour Change
May 30, 2013 09:34 AM|lenovo1|LINK
HI,
i am having some difficulty trying to get my text to change based on an expression / rule.
how can i do this based on my example from access:
=Switch (Fields!StatusSummary ="GIVEBACK" And Fields!StatusLastChanges <Now()-42, "Red",
Fields!StatusSummary ="GIVEBACK" And Fields!StatusLastChanged <Now()-21 And Fields!StatusLastChanges>Now()-42, "Amber",
Fields!StatusSummary ="GIVEBACK" And Fields!StatusLastChanges>()-21, "Green" )
- this changes colour depending on the rule. red, amber and green.
how can i do this in SSRS?
Member
220 Points
64 Posts
Re: SSRS Expressions, Font Colour Change
May 31, 2013 08:15 AM|Abhi.ssrs|LINK
Go to the font properties of the field you intend to change the color on and then write an expression on Color property of font :
= Switch( Fields!StatusSummary = "Giveback" and Fields!statusLastChanges < Date() - 42 , "Red",
Fields!StatusSummary = "Giveback" and Fields!statusLastChanges < Date() - 42 ,"Amber",
Fields!StatusSummary = "Giveback" and Fields!statusLastChanges < Date() - 42 ,"Green"
)
The switch expression works like " Switch( Condition1, Result1,
Condition2 , Result2,
...etc)
You might need to change the fields and add date conversion in above expression to work as you need.
Member
10 Points
55 Posts
Re: SSRS Expressions, Font Colour Change
May 31, 2013 09:36 AM|lenovo1|LINK
Hi Abhi.ssrs, thank you for the reply.
switch looks like the way i need to go. the problems i am running into are changing Date to Today() or Now() and adding the -42.
=Switch (Fields!StatusSummary =
"GIVEBACK" And Fields!StatusLastChanges <Now()-42, "Red",
Fields!StatusSummary =
"GIVEBACK" And Fields!StatusLastChanged <Now()-21 And Fields!StatusLastChanges>Now()-42, "Amber",
Fields!StatusSummary =
"GIVEBACK" And Fields!StatusLastChanges>()-21, "Green" )
Errors when i run the report
"The Color expression for the textrun 'StatusSummary.Paragraphs[0].TextRuns[0]' contains an error: [Bc30518]: overload resolution failed because no accessinle '=' can be called with rhese arguments"
- 42 gets me an error '-' not a valid expression and a syntax error for Today() and Now(), how could i fix these problems?
thank you
Member
220 Points
64 Posts
Re: SSRS Expressions, Font Colour Change
Jun 03, 2013 01:05 AM|Abhi.ssrs|LINK
Hi, Sorry for the delayed response.
The adte operation can be handled like
=IIF(CDate("4/21/2012")< DateAdd(DateInterval.Day, - 40,Globals!ExecutionTime) , True,False)
In Your case try this as a switch :
Switch(CStr(Fields!StatusSummary) ="GIVEBACK" And CDate(Fields!StatusLastChanges) < DateAdd(DateInterval.Day, - 42,Globals!ExecutionTime), "Red",
....)
Lemme know if this doesn't help
Member
10 Points
55 Posts
Re: SSRS Expressions, Font Colour Change
Jun 03, 2013 07:28 AM|lenovo1|LINK
Hi,
i have come back to this part of my project to try and get this working, is anybody able to shine some more light on how i can get this working?
Again i need to to work like below:
=Switch (Fields!StatusSummary ="GIVEBACK" And Fields!StatusLastChanges <Now()-42, "Red",
Fields!StatusSummary ="GIVEBACK" And Fields!StatusLastChanged <Now()-21 And Fields!StatusLastChanges>Now()-42, "Amber",
Fields!StatusSummary ="GIVEBACK" And Fields!StatusLastChanges>()-21, "Green" )
Thanks in advance!