This topic is locked
[SOLVED]

 How to change a field color in a report

3/21/2011 4:50:45 AM
PHPRunner General questions
D
drk2009 author

I have the following query with Aliases.
SELECT t1.Week,

t1.s2009,

t1.CSUM2009,

t2.s2010,

t2.CSUM2010,

(CSUM2010 - CSUM2009)/CSUM2009 * 100 AS %_Increase,

CSUM2010 - CSUM2009 as GAP

FROM ( SELECT Week,

s2009,

@Tot := @Tot + s2009 AS CSUM2009

FROM ( SELECT WEEKOFYEAR(sqldate) Week,

SUM(sqlvalue) s2009

FROM statval1

WHERE YEAR(sqldate) = '2009'

AND (stat_number = '363')

GROUP BY WEEKOFYEAR(sqldate)) AS WEEK,

(SELECT @Tot := 0) r

ORDER BY Week) AS t1

JOIN ( SELECT Week,

s2010,

@Tot1 := @Tot1 + s2010 AS CSUM2010

FROM ( SELECT WEEKOFYEAR(sqldate) Week,

SUM(sqlvalue) s2010

FROM statval1

WHERE YEAR(sqldate) = '2010'

AND (stat_number = '363')

GROUP BY WEEKOFYEAR(sqldate)) AS WEEK1,

(SELECT @Tot1 := 0) r

ORDER BY Week) AS t2

ON t1.Week = t2.Week
The report is order by WEEK which is WEEKOFYEAR field (SQLDATE).
The above report generates 6 columns orders by weekofyear(week), I would like to

know how to change the text color of a row from black to Green for the row which weekofyear

is equal today's weekofyear, and also be able to print it in green on the print friendly option.
I have looked on the forum but can't find a solution.
Can someone please show me how to do it?
Thank you

Sergey Kornilov admin 3/21/2011

Derek,
you can use technique described in this article to change colors on report page:

http://xlinesoft.com/blog/2011/01/03/tutorial_conditional_formatting/

D
drk2009 author 3/21/2011



Derek,
you can use technique described in this article to change colors on report page:

http://xlinesoft.com/blog/2011/01/03/tutorial_conditional_formatting/



Hello Sergey,
Thank you. I got it working.
The code that I needed is:

------

$weekNumber = date("W");

if ($value != $weekNumber){

$color="black";

} else {

$color="red";

}

$value="<span style='color: " . $color . ";'>$value</span>";

-------
For anyone interested.