Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Reporting Services
»
Reporting Services
»
Need help in giving the expression for...
Need help in giving the expression for background color for a column
Rate Topic
Display Mode
Topic Options
Author
Message
Mac1986
Mac1986
Posted Tuesday, January 08, 2013 4:25 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 4:07 AM
Points: 180,
Visits: 516
Hi All,
I have a column 'RunTime' with following format of data in it. I need to give an expression for back ground color of this column as 'RED' if the RunTime >= 2 Hrs
For my earlier reports I was using = IIF(Fields!Runtime.Value > 2,"RED","SpringGreen") and it used to work. but I guess that because the column format was integer.
Can someone please help ASAP. Need to get this done tonight.
Thanks in Advance.
Post #1404137
anthony.green
anthony.green
Posted Tuesday, January 08, 2013 4:28 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075,
Visits: 4,833
Could you not format out in the data set an int based column which is used in the expression, but not shown in the report?
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1404140
Mac1986
Mac1986
Posted Tuesday, January 08, 2013 4:35 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 4:07 AM
Points: 180,
Visits: 516
sorry for confusion. here is what the column looks like.
22 Hrs : 34 Mins
16 Hrs : 34 Mins
8 Hrs : 35 Mins
0 Hrs : 36 Mins
Now i need to put red color for the ones that are >= 2 Hrs
Post #1404145
Mac1986
Mac1986
Posted Tuesday, January 08, 2013 4:36 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 4:07 AM
Points: 180,
Visits: 516
Is there a way that I can take only the first digit of the column and see if its >= 2 and mark it as red color in the expression?
Post #1404147
Mac1986
Mac1986
Posted Tuesday, January 08, 2013 4:37 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 4:07 AM
Points: 180,
Visits: 516
That was just my thought. I mean please share your idea how mark the background color as red.
Post #1404148
anthony.green
anthony.green
Posted Tuesday, January 08, 2013 4:47 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075,
Visits: 4,833
Could you not get left 1, convert it to int, then do > 2
CInt(Left(Fields!Field.Value,1)) > 2
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1404156
Mac1986
Mac1986
Posted Tuesday, January 08, 2013 5:11 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 4:07 AM
Points: 180,
Visits: 516
How can I add a condition to the below expression? Please help
(CInt(Left(Fields!Runtime.Value,1)) >= 2,"Red"),"Transparent"
Post #1404168
anthony.green
anthony.green
Posted Tuesday, January 08, 2013 5:12 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075,
Visits: 4,833
You would just build that into your background expression as you have done
=IIF( CInt( Left(Fields!Runtime.Value,1)) >= 2,"Red","Transparent")
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1404171
Mac1986
Mac1986
Posted Tuesday, January 08, 2013 5:19 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 4:07 AM
Points: 180,
Visits: 516
That worked thanks a lot. You saved me big time tonight..
Post #1404175
anthony.green
anthony.green
Posted Tuesday, January 08, 2013 5:25 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075,
Visits: 4,833
Doh moment
LEFT("16",1) = 1 which doesnt match the value as that should go red, do left 2, so change it to CInt(REPLACE(LEFT(Fields!Field.Value,2)," ","")), that way if it picks "1 " or "0 " it will remove the space and do the correct comparission
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1404177
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.