1 Reply Latest reply: Apr 30, 2012 7:29 AM by Satya Ranki Reddy RSS

    A quick solution needed

    UOOLK
      I have two queries to ask

      1. In OBI answers- pivot table

      In the column section i have two columns Week and Week ago but they are placed one below the other na dthe data doesnt seems to diplay correctly
      What is the way to place the columns horizontally one next to other?

      2 within the same report in the measures section i want to add a blank row within the table to make the table look readable
      is there anything that will ass a blank row in the measures section.

      thanks
        • 1. Re: A quick solution needed
          Satya Ranki Reddy
          HI,

          This is not a native feature of OBIEE, however with a little cleaver javascript, you can accomplish this.

          1) Setup your pivot table as you normally would
          2) Add a static text object to the bottom of your report
          3) Enable HTML in the static text block
          4) Paste the following code into your static text block
          <script type="text/javascript">

          var debug =0; // set debug variable

          if (debug === 1) { document.write("Get all tables"+"<BR>");}
          var tables = document.getElementsByTagName('table');

          if (debug === 1) { document.write("Loop over the tables"+"<BR>");}
          for(var table=0; table < tables.length; table++){

          //if (debug === 1) { document.write("Check to see if we arrived at a pivot table"+"<BR>");}
          if(tables\[table\].className != 'PTSectsTable' ){
          //if (debug === 1) { document.write("We did not encounter a pivot table"+"<BR>");}
          continue;//not the correct tag, keep looping
          }

          if (debug === 1) { document.write("Found a pivot table"+"<BR>");}


          var tbody = tables\[table\].getElementsByTagName('tbody')\[0\];
          if (debug === 1) { document.write("Grabbed the tbody code"+"<BR>");}


          var trs = tbody.getElementsByTagName('tr');


          var new_tr = document.createElement('tr');
          if (debug === 1) { document.write("Created the new_tr variable"+"<BR>");}


          while( trs.length > 0){

          var new_td = document.createElement('td');
          if (debug === 1) { document.write("Created a new TD element."+"<BR>");}


          var new_table = document.createElement('table');
          if (debug === 1) { document.write("Created a new table element."+"<BR>");}


          var new_tbody = document.createElement('tbody');
          if (debug === 1) { document.write("Created a new tbody element."+"<BR>");}


          new_tbody.appendChild(trs\[0\]);
          if (debug === 1) { document.write("Appended Section."+"<BR>");}


          new_tbody.appendChild(trs\[0\]);
          if (debug === 1) { document.write("Appended Data."+"<BR>");}


          new_table.appendChild(new_tbody);
          if (debug === 1) { document.write("Appended tbody to the table tag."+"<BR>");}


          new_td.appendChild(new_table);
          if (debug === 1) { document.write("Appended table to the TD tag."+"<BR>");}


          new_tr.appendChild(new_td);
          if (debug === 1) { document.write("Appended td to the overall TR tag."+"<BR>");}


          //if (debug === 1) { document.write("Inspecting Node: "node"<BR>");}


          //if (debug === 1) { document.write("TagName: "tbody.childNodes\[node\].tagName" with className: "tbody.childNodes\[node\].className"<BR>");}
          }


          tbody.appendChild(new_tr);
          if (debug === 1) { document.write("Inserted the new_tr variable as the first child of tbody"+"<BR>");}
          }

          if (debug === 1) { document.write("Finished transposePivotTable"+"<BR>");}

          </script>
          5) Save and watch the javascript re-render your report horizontally instead of vertically

          I've tested the code in Mozilla and IExplorer.

          Best regards and if you found this post useful, please award points!

          Award points it is useful.

          Thanks!

          Satya