Conditional Background color with customcode
Hi, I am newbie to SSRS. I have to write a custom code for background color property of a text box depending on the parameters selected in the report. I cannot put an expression as there are three different conditions in the conditions in the report. Please help me how to write a custom code and relate it to the parameters selected in the report. In my research I found a custom code like this: Public Function GetColor(ByVal status as String) as String IF status = "1" Then Return "White" End IF IF status = "2" Then Return "Yellow" End IF IF status = "3" Then Return "Tomato" End IF End Function I need to replace status with the parameters in my report. Please guide me... Thanks, Ravi
May 23rd, 2011 11:15pm

You could try writing this expression in the background color property fot that particular text box. iif(parameters!ParameterName.Value = "1","White",iif(parameters!ParameterName.Value="2",yellow,iif(parameters!ParameterName.Value="3",Tomato,"Blue"))) HTH, RamRam
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2011 11:21pm

I cannot use an expression, but can handle it only in custom code. I have just sent you a sample custom code which I found in google. Please helpe me in writing custom code (I should not use expression as it doesn't solve my purpose). Thank you!
May 24th, 2011 2:32pm

If I could handle in the expression, that would be great.. I need something like this: I have to add this case statement CASE Reason WHEN Parameters!P1=Fields!F1 THEN 'Yellow' WHEN Parameters!P2=fIELDS!F2 THEN 'Green' ELSE Fields!F3.vALUE=1 THEN 'Blue' or OR RowNumber(Nothing) MOD 2, "White", "Light Blue")
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2011 3:26pm

iif(Paramaters!P1.Value = Fields!F1.Value,"Yellow",iif(Paramaters!P2.Value = Fields!F2.Value,"Green",iif(Fields!F3.vALUE=1,"Blue", iif(RowNumber(nothing)Mod 2,"White","Light Blue")))) HTH, Ram Ram
May 25th, 2011 12:14am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics