Wednesday 11 April 2012

Removing Totals of a column

In one of the OTN forum, user asked to remove one of the Totals of a column.
My first thought was javascript.
So below is the report which shows the two dimensions and two measure columns.
Suppose, the user wants to remove the total of the second measure column.


Then first you need to place the report in the dashboard and get the HTML by 'View Source'.
Then you need to find the appropriate td tag and remove it.
This will remove the total of the second column.
Script:

<head>
<script type="text/javascript">
var element1 = document.getElementsByTagName('td');
var count=0;
var classname2 ="TTHT PTHT PTLR PTLC OORT";
for (var j = 0; j < element1.length; j++)
{
var classes1 = element1[j].className;
if (classes1==classname2)
 {
 count=count+1;
 if(count==1)
 {
 element1[j].parentNode.removeChild(element1[j]);
 }
 }
}
</script>
</head>

This should help many folks trying to remove bits and pieces.

No comments:

Post a Comment

Thanks to Comment
--Add--