SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Change color of text by value


Change color of text by value

Author
Message
Chrisbaeck
Chrisbaeck
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 3
hi, im making a report with Report Builder and im trying to change the color of a text when the value changes

for example if the value is - TOP RAIL, BOTTOM RAIL, MID RAIL, MID RAIL 1, MID RAIL 2 the text should be RED

if the value is LEFT STILE, RIGHT STILE, MID STILE, MID STILE 1, MID STILE 2 the text should be BLUE

any help would be great!

Thanks
Thom A
Thom A
SSC-Forever
SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)

Group: General Forum Members
Points: 46176 Visits: 15686
Add an expression to the colour on the text box which returns the colour. To start you off:
=iif((Fields!YourField.Value = "TOP RAIL") Or (Fields!YourField.Value = "BOTTOM RAIL"), "Red", iif((Fields!YourField.Value = "LEFT STILE") Or (Fields!YourField.Value = "RIGHT STILE"), "Blue" "Black"))


Alternatively, if you have very complex logic, you could use your query to do the work (as you have access to IN and proper CASE expressions), and return the colour you want as a value in a column. Then set the colour of the text box text to the value of that column (again using an expression).


Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does :-P

Please always remember to encapsulate your code in IFCode Markup. For example [code=sql] [/code].
Click here to read Jeffs Guide on how to post SQL questions, and get swift and helpful answers from the community
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search