3 Replies Latest reply on Jul 10, 2017 4:07 PM by Gianni Ceresa

    hiding subtotal  conditionally



      I have a requirement where I want to hide subtotal conditionally. please let me know in case if we can do that.

        • 1. Re: hiding subtotal  conditionally
          Gianni Ceresa


          First it would be good to have a read of How to Ask Questions in Developer Community Spaces  ...


          I guess you got your answers already yesterday in the other thread: grand total issue in obiee


          You are not in Excel, things works in a given way, based on attributes and measures and by doing things based on these elements.

          If you display a subtotal in a view for a given attribute the subtotal will be there for all the values of that attribute. So you will have a subtotal for "B" as well.

          • 2. Re: hiding subtotal  conditionally

            hi Gianni,

            we can understand but would there be any workaround while playing with css statementas below:-


            < script type="text/javascript">


            var tds = document.getElementsByTagName("td");


            for(var i = 0; i < tds.length; i++)


            if(tds.innerText == "Value Total")
            tds[i].parentNode.style.display = "none";

            < /script>



            but still it wont works for us.






            • 3. Re: hiding subtotal  conditionally
              Gianni Ceresa

              Sorry to ask but ... do you know CSS and Javascript?

              Because the piece of code you posted in mainly Javascript, and if it find a <td> tag with inside exactly (and only) the text "Value Total" it will hide the parent element (which is going to be the <tr> tag, the row).

              In theory it will work just fine, except for one detail: the HTML code of the table where you want to remove the row isn't inside the page when the javascript is executed.


              Visualizations (including tables) are loaded asynchronously by background request fired by your browser, so if you don't execute your javascript after having received the result (and after the code has injected the received HTML into the page) you will never manage to hide the row.

              Also a detail: your script is super slow and using tons of resources for nothing as you loop over all the <td> of the page, there must be few hundreds ...


              If you want to hack the UI with javascript you must first analyse how the front-end is built and how things are done, then write your code if you believe the effort is worth the result (it will take time to write and test it, it will maybe not work anymore at the next patch or upgrade, it will not work for print and exports).