Showing posts with label detail. Show all posts
Showing posts with label detail. Show all posts

Sunday, March 11, 2012

Change Color of Textbox Depending on Value

He is my question depending on the code field from my database I need to display a different color. The field is a detail in my table with just text displaying the title of the report. I have the actual code value in another column. I then go to the background color expression and am using this code:

=Iif(First(Fields!Code.Value, "CodeDataset") = 3, "Green", Iif(First(Fields!Code.Value, "CodeDataset") = 4, "Blue", "Red" ))

They all work if you pull the report up one at a time, but when selecting multi-values you get the color from the first record on each report page no matter what the second, third or so on values are. The code field does display each correct code. Is this being hard-coded to the first record?

Any Idea's ?|||

if your statement:

=Iif(First(Fields!Code.Value, "CodeDataset") = 3, "Green", Iif(First(Fields!Code.Value, "CodeDataset") = 4, "Blue", "Red" ))

You are evaluting the First Fields value "Literally" if you change it to

=Iif(Fields!Code.Value= 3, "Green", Iif(Fields!Code.Value = 4, "Blue", "Red" )) - red will be the default value I think you will see the proper results.

|||

Great thanks it was simple good I tried it with out the first,but I did still have the "DataSet" in there. What is first called is it a function so I can do some research. Also how do you do is null in an expression, and convert data types for a value? Thanks so much for your help!!!

=Iif(Fields!Days.Value is Null, "AliceBlue", "White")

|||

I tried this code for my returntime field: Do I need to do a data conversion?

=Iif(Fields!ReturnTime.Value <= 0, "AliceBlue", "Transparent")

Build complete -- 0 errors, 0 warnings

[rsRuntimeErrorInExpression] The BackgroundColor expression for the textbox ‘Days’ contains an error: Operator '<=' is not defined for type 'Date' and type 'Integer'.

Preview complete -- 0 errors, 1 warnings

|||

Humm,

I think its the "<=" should work try Fields!ReturnTime.Value < 0 or Fields!ReturnTime.Value = 0 instead.

Thursday, March 8, 2012

change chart color

Hello,

Is it possible to specify color in more detail in the switch statement?

not "yellow" or "red" but I want to determine the colors by "RGB-values"...

hope everyone understands my problem

regards,

Rhapsy

Not sure I understand your question, but you can specify colors as RGB values like HTML colors. Instead of specifying a color by name, you specify it as RGB values, e.g.:

#00FF00

-- Robert

|||

Hi Rhapsy,

This is what I use for charts

Put this in the code window (Reports/Properties/Code). you can use RGB values or colour names

Public Function Qtr_Colour(Quarter as String) As string

Dim Bar_Colour as String

Select Case Quarter

Case "Qtr 1"

Bar_Colour = "#CCCCCC"

Case "Qtr 2"

Bar_Colour = "#333333"

Case "Qtr 3"

Bar_Colour = "#FFCC00"

Case "Qtr 4"

Bar_Colour = "Silver"

Case "Qtr +"

Bar_Colour = "LightYellow"

Case Else

Bar_Colour = "#FFFFFF"

End Select

Return Bar_Colour

End Function

Then reference it in the formatting area of your chart data item (chart properties/data:values/edit/appearance/series style/ fill) like this...

=code.Qtr_Colour(Fields!Quarter.Value)

Hope that's of interest to you.

99

|||hello,

thank you for your answers. they are both helpful and that exactly what i'm loking for ...

thanks,

rhapsy