Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

OBIEE 12g - No option to change the orientation of Pivot Tables with sections from row to column

Received Response
21
Views
2
Comments
Tinotarantino-Oracle
Tinotarantino-Oracle Rank 2 - Community Beginner

The now archived discussion (started way back on 10g in 2010 --- https://community.oracle.com/message/12506211#12506211)

provided a solution to change default section orientation from row to column.   Still no option exists today in 12g (as for as I can tell).    Here's an updated

solution based on the original solution that uses Javascript to override the DOM that is generated by OBIEE 12g.   You'll need to create

a static text box in your composite view with HTML enabled.

I've attached an alternate version the code that DOES WORK for my "section" enabled
Pivot table.    Here's the "BEFORE"  row oriented section layout in my analysis.   Note:  I use

the Samples Sales Catalog that is delivered with SampleApp.  Section is by Year:  2013, 2014, 2015


pastedImage_3.png

Here is the "AFTER".  In my static text box,  I have a button that calls the function:  transposePivotSection.   This function transposes the row sections to

column sections (see below).

  pastedImage_4.png

My Code:

<!--

<div id="myPivotContainer">

<table>

<tbody>

    <tr>

        <td>A</td>

    </tr>

    <tr>

        <td>B</td>

    </tr>

    <tr>

       <td>C</td>

    </tr>

    <tr>

        <td>1</td>

    </tr>

    <tr>

        <td>2</td>

    </tr>

    <tr>

        <td>3</td>

    </tr>

</tbody>

</table>

</div>

-->

<p>Click the button to transpose OBIEE pivot table sections from rows to column orientation.</p>

<button onclick="transposePivotSection()">Try it</button>

<script>

function transposeSimpleTable() {

    var debug = 1;

    var pivot_container_node =  document.getElementById("myPivotContainer");

    var table_node = pivot_container_node.getElementsByTagName('table');

    var tbody_node = table_node[0].getElementsByTagName('tbody');

    var trs = tbody_node[0].getElementsByTagName('tr');

    var new_tbody = document.createElement('tbody');

    var new_tr = document.createElement('tr');

    for(var tr=0; tr < trs.length; tr++){

        var new_td = document.createElement('td');

        new_td.innerHTML = trs[tr].innerHTML;

        new_tr.appendChild(new_td);

        if (debug === 1) { console.log("Appended new td node");}

    }

    new_tbody.appendChild(new_tr);

    table_node[0].replaceChild(new_tbody, tbody_node[0]);

}

function transposePivotSection() {

    var debug = 1;

    var toggle_section_row = true;

    var ClassName = '';

    var pivot_container_node =  document.getElementsByClassName('PivotContainer');

    var table_node = pivot_container_node[0].getElementsByTagName('table');

    var tbody_node = table_node[0].getElementsByTagName('tbody');

    var trs = tbody_node[0].getElementsByTagName('tr');

    var new_tbody = document.createElement('tbody');

    var new_tr = document.createElement('tr');

    for(var tr=0; tr < trs.length; tr++){

   

        if (toggle_section_row === true)

            {

            ClassName = 'PTSection';

            }

        else {

            ClassName = 'PTChildPivotTable';

            }

        var PTnode = trs[tr].getElementsByClassName(ClassName);

        if (PTnode.length !== 0 ) {

            var cln_PTnode = PTnode[0].cloneNode(true);

            new_tr.appendChild(cln_PTnode);

            toggle_section_row = !toggle_section_row ;

       

        }

    }

    new_tbody.appendChild(new_tr);

    table_node[0].replaceChild(new_tbody, tbody_node[0]);

}

</script>

Answers

  • asim cholas
    asim cholas Rank 6 - Analytics Lead

    It can be done in BI Publisher , i think.

  • It has never been an option and custom pieces of codes were posted by users for OBIEE 10g, OBIEE 11g and OBIEE 12c around the forum. So when people search for it they generally find these old threads and they just need to find the right version for them.

    Important to note that as any custom code it can stop working at any update/upgrade if there is a change in the code, and will also not produce the same output when exporting etc.