Wednesday, April 29, 2015

Display a list of dashboards based on permissions OBIEE11g


A way to display a list of dashboards based on permissions :
 
 
Create a text box on a dashboard page. enable HTML check box in the text box.copy below html/js code to the text box. just save and run the dashboard you can see the list of Dashboards.

<img id="loading" src="/analytics/res/sk_blafp/catalog/loading-indicator-white.gif" />
<div id="dash_list"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript">
$.ajaxSetup({
    beforeSend:function(){
        $("#loading").show();
    },
    complete:function(){
        $("#loading").hide();
    }
});
$.ajax({
url: "saw.dll?getDashboardList"
}).done(function( data ) {
    var start = data.indexOf('[');
    var end = data.lastIndexOf(']');
    var len = end-start+1;
    var json_str = data.substr(start,len);
    var json_obj = jQuery.parseJSON(json_str);
    var str = 'You have access to the following dashboards:<br/> <table align="left" border=1>';
   var loopend=0;

str+='<tr>';
    $.each(json_obj, function() {

        if (loopend%5==0)
{
str+='</tr>';
str+='<tr>';
}
loopend++;
        if (this.folderName!=='Welcome'){
            str += '<td valign="top" width="15%" height="15%" ><div style="float:left;margin:5px 10px;";><b>' + this.folderName + '</b><br\>';
            $.each(this.portals, function() {
                    str += '<a href="saw.dll?Dashboard&PortalPath=' + this.portalPath + '">' + this.portalName + '</a><font color="red"> / </font>';
              });
            str += '</div></td>';
        }
    });
str+='</tr>';  
str+='</table>'
$('#dash_list').html(str);
});
</script>

No comments:

Post a Comment