Hi, my first post and looking for some assistance please. Although there are a lot of posts on conditional format, i could not find one to answer my specific issue.
I am looking to conditionally change the background of individual fields (cells) on my tabular results report.
the report is grouped and has sub totals and a total using aggregates and consists of a large number of fields, each column having a total.
The report works fine, but I want to change the background of the data fields
i.e. if the data contained = 1. then colour the cell green
I have so far used this code in my footer
<SCRIPT LANGUAGE="JavaScript">
var elems = document.getElementsByTagName("td");
for (var i=0, m=elems.length; i<m; i++) {
if (elems[i].innerHTML=="1") { elems[i].style.color="BACK";}
if (elems[i].innerHTML=="1") { elems[i].style.backgroundColor="LIGHTGREEN";}
}
</SCRIPT>
this works but it also colours the background of the totals, subtotals in these fields where the subtotal = 1 as well.
I have the grouping rows set to a different background colour in the style, which this code above seems to over-write if the total value is a 1
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
StephenS
Hi, my first post and looking for some assistance please. Although there are a lot of posts on conditional format, i could not find one to answer my specific issue.
I am looking to conditionally change the background of individual fields (cells) on my tabular results report.
the report is grouped and has sub totals and a total using aggregates and consists of a large number of fields, each column having a total.
The report works fine, but I want to change the background of the data fields
i.e. if the data contained = 1. then colour the cell green
I have so far used this code in my footer
<SCRIPT LANGUAGE="JavaScript">
var elems = document.getElementsByTagName("td");
for (var i=0, m=elems.length; i<m; i++) {
if (elems[i].innerHTML=="1") { elems[i].style.color="BACK";}
if (elems[i].innerHTML=="1") { elems[i].style.backgroundColor="LIGHTGREEN";}
}
</SCRIPT>
this works but it also colours the background of the totals, subtotals in these fields where the subtotal = 1 as well.
I have the grouping rows set to a different background colour in the style, which this code above seems to over-write if the total value is a 1
help would be appreciated thanks
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.