Friday, June 20, 2014

OBIEE 11g : Using Popup Boxes/Alerts with prompts

We can make use of JavaScript Popup boxes in OBIEE 11g UI customization.

We can associate these alert messages with dashboard prompts.

We can achieve data validation using these alerts.

For this we create a prompt as Number1 and Number2. Also we define presentation variable as num1 and num2 respectively.


 


Now we add text view and add following code to it.

                <head>
                <script type="text/javascript">

                var num1='@{num1}';
                var num2='@{num2}';

                alert('Number 1 is '+num1+'and number 2 is '+num2);

                </script>
                </head>

This code simply checks numbers entered in text boxes and generates alert.




As you can see an alert is being shown when we apply prompts. According to our script it simply shows numbers entered in text boxes.

Here we use ‘alert()’ function of JavaScript to generate alert.
Also we can use presentation variables i.e. num1 and num2 to initiate variables.

Now consider following code.
We can also check other operations as following code.


                <head>

                <script type="text/javascript">

                var num1='@{num1}';
                var num2='@{num2}';

                if(num1>num2)
                alert('Number1 is greater than number2' );

                else if(num1<num2)
                alert('Number2 is greater than number1' );

                else
                alert('Number1 and number2 are same' );

                </script>

                </head>


This script compares numbers entered in 2 text boxes and generates alert as follows.









No comments:

Post a Comment