Wednesday, June 4, 2014

Javascipt to move print export link on top of report in OBIEE

1.          Create new analysis or edit existing report.

 

2.          Add one text view in report and place it between report title and table view.

 

3.          Add following code (only for print and export, need to modify for other links) into text view and enable HTML markup.

<div id="content1" onmousemove="fun(event)">
    <a href="">Print</a> - <a href="">Export</a>
</div>
<style>
    .ResultLinksCell {
        position: fixed;
        top: -20px;
        left: 0px
    }
</style>
<script>
    function fun() {
        var i;
        var element = document.getElementsByTagName("a");
        for (i = 0; i < element.length; i++) {
            if (element[i].target == 'obipsAnsPrnWnd' || element[i].name == 'html')
                element[i].parentNode.removeChild(element[i]);
        }
        var i = 0;
        if (document.getElementById("content1")) {
            for (var l = 0; l < element.length; l++) {
                if (element[l].title == "Print in different format") {
                    document.getElementById("content1").innerHTML = "<a href=\"javascript:void()\" onclick=\"" + element[l].getAttribute("onclick") + "\" >Print</a>";
                    var content = document.getElementById("content1").innerHTML;
                }
                if (element[l].title == "Export to different format") {
                    document.getElementById("content1").innerHTML = content + " - " + "<a href=\"javascript:void()\" onclick=\"" + element[l].getAttribute("onclick") + "\" >Export</a>";
                    i++
                    if (i == 1) break;
                }
            }
        }
    }
</script>

4.          Add the report on dashboard page, check print and export options in report links.

5.          Run the dashboard and links are available on top.

This code will work with any report in OBIEE 11.1.1.6.0 and higher. There is no need to take links for individual report and maintain them.
Also no need to change any code after migration. This will work just fine.

 

9 comments:

  1. Hi,

    Thank you for publishing wonderful solution. This is working on one report only per Dashboard page. If we have multiple reports on Dashboard page. How can we tweak to make it to work? Currently when we have on several reports on dashboard, it's working only on the first one and on the remaining reports its reloading the browser or refreshing all the reports. Any thoughts are truly appreciated.

    Thanks

    ReplyDelete
    Replies
    1. Hello Rea,

      You can reuse same script with differnet number e.g. content2, content3 inplace of content1 and replace (i == 1) to (i == 2) or (i == 3) based on number of reports you have. Hope it helps.



      Regards,
      Abhijeet

      Delete
    2. Hi Abhijeet,

      Appreciate and thankyou for quick turnaround !! I have updated to content2 and also replaced at one place i==1 to i==2 but it still kept refreshing the browser. Any additional thoughts !!

      Thanks
      Rea

      Delete
  2. Hi Abhijeet,

    Thanks a lot for this amazing blog. I was just wondering, if there is a way to capture the Export link i.e if the user clicks Export, then we kind of capture that event and call some Java script or something else.

    Angad

    ReplyDelete
  3. Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. auto insurance services in avebury

    ReplyDelete
  4. written content. I added new knowledge to my database for essay writing skill.โรงพิมพ์หนังสือ

    ReplyDelete
  5. There is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Thank you for your clear information. high quality Automatic Recirculation Valve

    ReplyDelete
  6. Your blog is very informative. Eating mindfully has been very hard for people these days. It's all because of their busy schedules, work or lack of focus on themselves. As a student I must admit that I have not been eating mindfully but because of this I will start now. It could help me enjoy my food and time alone. Eating mindfully may help me be aware of healthy food and appreciating food.
    Customs clearance

    ReplyDelete
  7. i never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. Insurance Marble Falls

    ReplyDelete