Pages

Friday, 21 June 2013

Single Apply and Clear Button for multiple Global Prompts in OBIEE 11g

A dashboard page with multiple global prompts having individual apply and clear button is a one of the problem for OBIEE 10g over the years. A solution has been in place which we used at many customer places is to use replace individual apply and clear button by single apply and clear button by using custom java code which is provided by development. There are many blogs which has this code published and subsequently used by customers.
One of the main reasons to have multiple global filters oriented from same subject area is limited option in OBIEE 10g to set constraint based on values selected by earlier column or columns. There was no option to choose the set of column/columns which we would like to set constraint based on.  With OBIEE 11g the global prompts works much more sophisticated and has more selection options than OBIEE 10g.
Do we need Single Apply button in OBIEE11g
Is there any need to use more than one global filter in OBIEE 11g ?  My simple answer is ‘NO’, I could not think of a situation where we need more than one global filter to set and hence we may end up with the problem of having multiple apply or reset buttons. In addition as OBIEE 11g allows to use multiple subject area to build a global filter with columns from different subject area makes me think that there is no need to use more than one global filter on a page.
Last week I was working on a small data discovery type of analytical requirement to be fulfilled by OBIEE 11g, it was an attempt to provide the Endca type of analytical reporting functionality via OBIEE interface to enable user for data discovery. I during design and development process I have realized that there are multiple situations where using multiple global prompt on dashboard page is routine.  In short I have been forced to look into solution to provide single ‘Apply’ and ‘Reset’ button for multiple global prompt in OBIEE 11g.
This blog is an attempt to list down the list of the activities which need to complete to achieve the Single button for global filter for OBIEE 11g. Obviously it is solution based on custom code provided by one of my Oracle Colleague which I am please to share with wider audience. The screen snapshots are based on OBIEE 11g (11.1.1.7.1).

Steps for Setting up Single ‘Apply’ and ‘Reset’ button in OBIEE 11g
Build a simple dashboard page with a report and multiple global filters, based on logical separations such as one for time and other for product etc as shown below. Too many Apply and Reset buttons, a complete non user friendly dashboard page.



Dashboard Page Formatting
Remove All Apply Buttons
Remove All Apply buttons by adding the syntax in the Text box, make sure that the check box “Contains HTML Markup” is selected.
<style type="text/css">.PromptViewCell .button{display:none}</style>
Text Box


The dashboard page should remove all ‘Apply’ buttons from page as shown below.


Remove All Reset Buttons
Choose Hide all Reset buttons using Dashboard properties to hide all Reset Buttons, don’t choose Hide all Apply buttons from Dashboard properties as that will enable Auto Run for the report when you select any values from any of the prompts.


The dashboard page should remove all ‘Reset’ buttons too from the dashboard page as shown.


Create new Apply and Clear button to handle all prompts on the page
For this step copy below syntax in Text box next to First mandatory prompt on the page.
Syntax:
<DIV CLASS = "XUIPromptEntry minibuttonOn">
<input class="button" type = "button" value = "Apply" onclick='javascript:
try
{
var x = 0;
var aElm=PromptManager.getPromptManager().getAllPromptCollectionJSON();
for(var i = 0; i < aElm.length;i ++ )
            {
            for(var j = 0; j < aElm[i].promptSteps[0].prompts.length;j ++ )
                        {
                        var promptid = aElm[i].promptSteps[0].prompts[j].promptStreamID;
                        var g = null;
                        var h = PromptManager.getPromptManager().getPromptCollectionInfoWithViewID(aElm[i].viewStatePath);
                        if(h)
                                    {
                                    try
                                                {
                                                var b = h.getAllPromptExprsArray();
                                                if( ! h.verifyPromptValuesAndDisplayError(b))
                                                            {
                                                            return;
                                                            }
                                                g = PromptManager.buildPromptExprGivenExpr("", b);
                                                }
                                    catch(f)
                                                {
                                                alert(f);
                                                return;
                                                }
                                    }
                        }
            x++;
            }
x--;
PromptManager.submitPrompt(aElm[x].viewStatePath, true,"PromptFinish", g)
}
catch(e) {alert("Apply ALL Button Exception" + e.description);}' ></input> 
<input class="button" type = "button"  value = "Clear" ONCLICK = 'return PersonalizationEditor.removeDefaultSelection(false)' > </input>
<div/>
Text Box

Dashboard page screen snapshot with the single ‘Apply’ and ‘Reset’ is as below.


I hope you find this blog entry with shared information on global filter is useful.

 

8 comments:

  1. This is awsome Pravin

    ReplyDelete
  2. Can we also add functionality of RefreshPage on click of Apply button

    ReplyDelete
  3. I have tried your solution, but whatever particular combination I use (I use both the texts for hiding the apply and reset and the javascript for the apply / clear buttons) I can only affect one of the prompts with the apply button, not both. The clear button seems to affect both prompts, just not the apply button. Clicking the apply button will reset one prompt, and take the other one.

    ReplyDelete
  4. I have tried your solution, but whatever particular combination I use (I use both the texts for hiding the apply and reset and the javascript for the apply / clear buttons) I can only affect one of the prompts with the apply button, not both. The clear button seems to affect both prompts, just not the apply button. Clicking the apply button will reset one prompt, and take the other one.

    ReplyDelete
    Replies
    1. Hi Robert,
      I am having the same problem. I can only affect one of the prompts with the apply button, not both. The clear button seems to affect both prompts, just not the apply button. Clicking the apply button will reset one prompt, and take the other one. Did you get an answer to this?

      Thanks,
      Sue

      Delete
  5. Hello
    I have tried your solution, but when I pressed the Apply button I receive this error message:
    TypeError: d is undefined
    Wold you please help me to splve this problem?
    thanks
    Bahareh

    ReplyDelete
  6. I have tried your solution, but when I press the Apply button I receive this error message :
    TypeError: d is undefined
    Would you please help me to solve this problem.
    Thanks
    Bahareh

    ReplyDelete
  7. SOLUTION

    Modify the Javascript code as below:

    From:

    ...
    var b = h.getAllPromptExprsArray();
    if( !h.verifyPromptValuesAndDisplayError(b))
    ...


    To:

    ...
    var b = h.getAllPromptExprsArray();
    if( !h.verifyPromptValuesAndDisplayError(b,{bCheckForRequired:true}))

    ReplyDelete