Single Button for multiple Global Prompts in OBIEE 11g

Single Button for multiple Global Prompts in OBIEE 11g:
Hi,

This requirement was faced by us and successfully implemented  by my Lead. I am sharing since it would be useful for all..
  • I have shared  a simple example of submitting two prompts which may not make much sense because these two prompts can easily be combined into a single prompt and using standard Apply and Reset buttons provides same functionality. However, the real use case is on dashboard pages with say 10~15 complex prompts that need to be logically laid out and can’t be combined into single prompt. Also, complex prompts may have already been built and need to be reused.
  • In the below screenshot you can see with example how 


  • Each prompt has an Apply and Reset button (more about disabling these buttons later) and the analysis runs separately for each prompt.As I said earlier, it is possible to combine these two simple prompts into one and in this case functionality will be same as the customization but we know it is not always possible to combine large number of prompts. Here is how this example  would look if we combine both prompts:
  •  Now add two text boxes as below:
  • Text 1 has code to hide all Apply buttons. You may be aware of other ways of hiding Apply buttons (check boxes on prompt and dropdown menu on page) but they make prompts execute immediately and we don’t want that behavior in this case. Also, this effects prompts that are placed below on page and this is the reason it needs to be on top.



















  • Text 2 has custom code for two buttons: one Resets ALL prompts and other is to APPLY ALL prompts. Don’t worry about reading all the code, I have the text below. Just make sure your text matches this. For example, ‘Contains HTML Markup’ should be checked and ‘Preview’ button is pressed, you should see two buttons.
  • Please note that copy/paste can sometimes break keywords and code may not work right away. Correct any errors and use preview button to make sure there are no errors.


<DIV CLASS = “XUIPromptEntry minibuttonOn”><A HREF = “#” ONCLICK = “return PersonalizationEditor.removeDefaultSelection(false)”>Clear ALL Prompts</A></DIV>
<div align = “left”> <a onclick=”javascript:customCall();” href=”#”> Apply ALL Prompts</a><div/>
<script language=”JavaScript”> function customCall() {
try{ 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
}
}
PromptManager.submitPrompt(aElm[i].viewStatePath, true, “PromptFinish”, g)
}
}
}
}
catch(e) {alert(“Apply ALL Button Exception ” + e.description);
}
}
</script>
  • Reset buttons can be disabled using standard navigation:






  • When this dashboard is run, this how it will look:
  • Selecting values in each prompt should not change analysis unit Apply ALL Prompts button is pressed:










  • Once the button is pressed after selecting all prompts, you should see analysis filtered on all prompts:






  • If you wish to implement this on a page with numerous prompts, please try on a simple page with two prompts first.
Hope It Helps!!

Thanks,
Shanmugha Bharathy G B

No comments:

Post a Comment