Sunday, November 1, 2020

Dynamic Dashboard and Dashboard Page Title (and color) in OAC, OAS and OBIEE

 Following the previous post (Font size of Dashboard name and Dashboard pages names in OAC, OAS and OBIEE), in rare cases we need it, we can have dynamic Dashboard and Dashboard Page names.

Please notice this trick only works with online Dashboards - not printing or exporting of the Dashboard or even Catalog.

 I will use a simplified version of it here. Usually real cases will be more complex and involve using URL to activate specific dashboard page.

What we did in previous post is controlling the Dashboards and pages fonts using HTML script. For example this is the Dashboard code:

    document.getElementsByClassName("masterH1")[0].innerHTML =  '<font size="3" > Dashboard Name</font>'

We also noticed we can use analysis that pass the script to Dashboards. 

In similar fashion we can remove the font part of the code (or leave if you prefer) and make the name part dynamic using Variables.

For example, we can modify the previous script to this:

    document.getElementsByClassName("masterH1")[0]> '@1'

How is it done?

I created an Analysis with one column that is a Presentation Variable (Could be any sort of variable such as Session or Repository...). In this case Presentation Variable Named P_Name with a default value.


Used it in Narrative view (@1 means the first column, Rows to display = 1, Mark the HTML option)

Just to demo it, created a Prompt with that Presentation Variable:

And used it in a Dashboard (you can't see the analysis itself in the Dashboard, since it is just HTML script).

In a similar fashion we could control the Page Name with several Variables:

    document.getElementsByClassName("masterH3")[0].innerHTML =  '@1'
    document.getElementsByClassName("masterH3")[1].innerHTML =  '@2'
    document.getElementsByClassName("masterH3")[2].innerHTML =  '@3'

Of course, this can work with the dynamic color as well:

    document.getElementsByClassName("masterH1")[0].innerHTML =  '<span style=\"color:@2\">@1'

No comments:

Post a Comment