mparks Posted November 23, 2015 Report Share Posted November 23, 2015 Has anyone found a way to color code the sections of a group report? So based on the group value all rows (background or text or both) would be a different color? Quote Link to comment Share on other sites More sharing options...
Xiang Posted December 1, 2015 Report Share Posted December 1, 2015 Hi MikeP, How are you? I've written the code (you can add an HTML Block, place it the last element, click the Source button and enter the code): Do not forget to change "id" in two places ([@field:id]) - enter the name of your field with unique value (usually it is a field with the Autonumber DataType) and enter your values in blocks "first possible value", "second possible value". You can use as many blocks as you want. <div id="[@field:id]"></div> <SCRIPT LANGUAGE="JavaScript"> var line_id='[@field:id]'; var number_records_per_page = 25; //Records per page var line=document.getElementById(line_id).parentNode.parentNode; var elems = line.getElementsByTagName("td"); var myColor = ""; var mybgColor = ""; var colorAll = false; var comparisonText = ""; if(elems[0].innerHTML==" ") { var isGroup = elems[0].parentNode.previousSibling.getElementsByTagName("td")[0]; if(isGroup.innerHTML==" ") { for(i = 1; i < number_records_per_page; i++) { isGroup = isGroup.parentNode.previousSibling.getElementsByTagName("td")[0]; if(isGroup.innerHTML!=" ") break; } } comparisonText = isGroup.innerHTML; } else { comparisonText = elems[0].innerHTML; } //first possible value if (comparisonText =="test" || comparisonText =="test (Cont.)") //enter your value instead of test { myColor="blue"; //enter your text color instead of blue mybgColor="yellow"; //enter your background color instead of yellow var colorAll = true; } //second possible value if (comparisonText =="test" || comparisonText =="test (Cont.)") //enter your value instead of test { myColor="red"; //enter your color instead of red mybgColor="green"; //enter your background color instead of green var colorAll = true; } if(colorAll) { for (var i=0, m=elems.length; i<m; i++) { elems[i].style.color=myColor; elems[i].style.backgroundColor=mybgColor; } } </SCRIPT> I'll be grateful, if you tell me if the code works.Have a nice day! MayMusic 1 Quote Link to comment Share on other sites More sharing options...
MayMusic Posted December 1, 2015 Report Share Posted December 1, 2015 MikeP did this work for you? Quote Link to comment Share on other sites More sharing options...
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.