Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Need help in giving the expression for background color for a column Expand / Collapse
Author
Message
Posted Tuesday, January 8, 2013 4:25 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 21, 2014 9:53 PM
Points: 219, Visits: 685
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
Posted Tuesday, January 8, 2013 4:28 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
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
Posted Tuesday, January 8, 2013 4:35 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 21, 2014 9:53 PM
Points: 219, Visits: 685
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
Posted Tuesday, January 8, 2013 4:36 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 21, 2014 9:53 PM
Points: 219, Visits: 685
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
Posted Tuesday, January 8, 2013 4:37 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 21, 2014 9:53 PM
Points: 219, Visits: 685
That was just my thought. I mean please share your idea how mark the background color as red.
Post #1404148
Posted Tuesday, January 8, 2013 4:47 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
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
Posted Tuesday, January 8, 2013 5:11 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 21, 2014 9:53 PM
Points: 219, Visits: 685
How can I add a condition to the below expression? Please help

(CInt(Left(Fields!Runtime.Value,1)) >= 2,"Red"),"Transparent"
Post #1404168
Posted Tuesday, January 8, 2013 5:12 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
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
Posted Tuesday, January 8, 2013 5:19 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 21, 2014 9:53 PM
Points: 219, Visits: 685
That worked thanks a lot. You saved me big time tonight..
Post #1404175
Posted Tuesday, January 8, 2013 5:25 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
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 »

Add to briefcase

Permissions Expand / Collapse