Hello,
I have a report datapage where using javacript in an HTML block, the color code changes in a Calculated Field depending on the value of 2 fields -
---------------------------------
if(('[@calcfield:2]'-[@field:Orders_Quantity])/[@field:Orders_Quantity]> .05){
var line_id='[@field:Orders_Serial_Number]';
var line=document.getElementById(line_id).parentNode.parentNode;
var elems = line.getElementsByTagName("td");
elems[13].style.backgroundColor="peru";elems[13].style.color="white";
}
---------------------------------
'Orders_Serial_Number' is the auto-numbered unique id. Column 13 is 'Calculated Field 2'. This works but if I add or remove any columns, then the wrong field changes color.
How do I reference Calculated Field 2 ([@calcfield:2]) in the line 'elems[13].style.backgroundColor="peru";elems[13].style.color="white";' instead of specifying the fixed column number 13?