Jump to content

Possible To Color Code Rows By Group In A Tabular Report?

Recommended Posts

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>
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;
  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;

   for (var i=0, m=elems.length; i<m; i++)

I'll be grateful, if you tell me if the code works.

Have a nice day!

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...