Wednesday 15 January 2014

OBIEE 11g - Single Apply Button

Steps to follow :
1.Don't hide "Apply" button from the dashboard.
    If you hide "Apply" button, values pass automatically from prompts to reports.
2.Hide "Reset" button from the dashboard.

Hide & Stop passing the values until click on the "Apply" button. For that follow the code

<style type="text/css">.PromptViewCell .button{display:none}</style>

For Single "Apply" button and the  functionality as follows,

<DIV CLASS = "XUIPromptEntry minibuttonOn">
<input class="button" type = "button" value = "Apply" onclick='javascript:

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);}'></input>

<input class="button" type = "button"  value = "Reset" ONCLICK = 'return PersonalizationEditor.removeDefaultSelection(false)' > </input>
</DIV>

"Apply" button settings


"Reset" Button Settings



I am having 2 different set of prompts
1st Prompt  contains period information (Year & Month)

Save as Test1 


2nd Prompt contains Office & Product information

Save as Test2

Report is as follows

Save as Test1

Hide & Stop Apply button functionality
Place the Blue in color code  in the Text box (in this example: Text1)


"Apply" & "Reset" button code and functionality
Place the Red in color code in the another Text box (in this example : Text2)


Dashboard layout 


Dashboard at Finally

Clicks on "Apply" button



Clicks on "Reset" button


Note : While copy & paste the codes beware of double quotes (" ). If double quotes are not proper in copying adjust and then paste.

7 comments:

  1. Hi There,
    Thanks a lot for the code, however when I am trying the above code it's not working. Its gives me error

    TypeError: Cannot set property 'bCalledFromMobileAPI' of undefined

    Any help would be much appriciated.

    Thanks in advance.

    ReplyDelete
  2. Did you get both the buttons (Apply & Reset)?

    Which code throwing error?

    ReplyDelete
  3. Even I am getting the same error...TypeError: Cannot set property 'bCalledFromMobileAPI' of undefined..Could you please inform why this is happening?

    ReplyDelete
  4. It happens for me as well (obiee 12.2.1.2.0)

    ReplyDelete
    Replies
    1. Replace "if( ! h.verifyPromptValuesAndDisplayError(b))" with "if( ! h.verifyPromptValuesAndDisplayError(b,{bCheckForRequired:true}))"

      But, now the CSS that hides the apply buttons stopped working for me (in Oracle Analytics Cloud). Anyone have a clue on that?

      Delete
  5. This code is workng fine in OBIEE 12C,but Export to Excel from dashboard is not working

    ReplyDelete
  6. A mí me pasa igual. Lo solucionaste?

    ReplyDelete