6 Replies Latest reply: Nov 29, 2013 8:38 AM by Jote RSS

    Help, using javascripts in an analysis

    Jote

      Hi

      I embarking om my very first javascripts tryout in OBIEE. Read some post, some blogs, some how tos and so on and they say usea "Static Text, mark HTML markup" ... so ... I did.

       

      Now. The problem I'm facing and that I don't really understand is why the same javascript code works in a dashboard Static Text object but NOT in an analysis Static Text object.

      The code I'm using is this one: https://google-developers.appspot.com/chart/interactive/docs/quick_start

      Just to see how thigns work before I try to make it work with my data. And that will be the other question ... how can I make the javascript use the columns from criteria in an analysis? Any documents?

       

      Anyone please?

        • 1. Re: Help, using javascripts in an analysis
          Himanshu Rai

          the columns in the criteria could be used as '@{1}', '@{2}' and so on (based on order) or otherwise as '@columnName'

           

          The javascript in static text does work. Try once with some plain javascript.

           

          Did u try with narratives instead for the analysis?

          • 2. Re: Help, using javascripts in an analysis
            Jote

            I'm a newbie with javascripts actually ... what do you mean "plain javascript"?

             

            I tried the same javascript code in the Narrative view and ... nothing. Empty. Doesn't show anything. That is what I don't understand. Why does it work in the Dashboards static text but not in the analysis?

            Do you have any easy examples?

             

            I just read: http://www.askjohnobiee.com/2013/06/how-to-data-visualization-with-external.html

            But this one downloads libraries and that I think is my next stel in evolution hahaha ... I want to make the googles scripts work first before I go into downloading libraries and stuff. Or am I understanding this worng?

            • 3. Re: Help, using javascripts in an analysis
              Himanshu Rai

              you can put the below script in the static text view in the analysis,

               

              <!DOCTYPE html>
              <html>
              <head>
              <script>
              function displayDate()
              {
              document.getElementById("demo").innerHTML=Date();
              }
              </script>
              </head>
              <body>

              <h1>My First JavaScript</h1>
              <p id="demo">This is a paragraph.</p>

              <button type="button" onclick="displayDate()">Display Date</button>

              </body>
              </html>

              • 4. Re: Help, using javascripts in an analysis
                Himanshu Rai


                Now with the Narrative you can refer to the criteria columns as below,

                 

                In prefix put,

                 

                <!DOCTYPE html>
                <html>
                <head>
                <script>
                function displayDate()
                {
                document.getElementById("demo").innerHTML=Date();
                }
                </script>
                </head>
                <body>

                <p id="demo">This is a paragraph.</p>

                <button type="button" onclick="displayDate()">

                 

                In narrative put,

                 

                '@1'

                 

                In rows to display put, 1

                 

                In postfix put,

                 

                </button>

                </body>

                </html>

                 

                 

                This would get the value from the first column of criteria as button's label.

                 

                Still wondering the google graphs on obiee would be of help

                • 5. Re: Help, using javascripts in an analysis
                  Jote

                  Thank you HimanshuRai

                  That Narrative code helped me out ... now I have to learn the rest. How to use this in charts of all kind.

                  Do you have any sites where they have an easier way of explaning things than Rittman Meads solution with D3.js and IE9? Our IT department is still on IE 8 and testing out IE10 ...

                   

                  Why google charts or D3 on obiee would help? Well, we all know that the charts in obi are pretty limited comparing it to other products. Our customers would like to see some new things, nicer charts and so on, bear in mind it's 2013 going for 2014 and obi stuff looks like SSRS from mid 2000. We are trying to take things to the next level to see if we find some kind of added value using javascripts and other charts, nice to have features and so on in obi.

                  For example, take a look at the link below, can you create the fourth trend chart in obi? Hover above the pink line and you'll see what I mean.

                  https://google-developers.appspot.com/chart/interactive/docs/gallery/trendlines

                   

                  What we are trying to create is our criteria together with some of the charts and nice things that D3 or google has. They have some pretty intresting things there. some over the top useless for our business, but some are pretty interesting. The thing is that I have limited javascript knowledge so far and we would like to link to the source libraries instead of downloading what ever is needed all the time, css or js files or what ever. There must be a simpler way ... right?

                  • 6. Re: Help, using javascripts in an analysis
                    Jote

                    Another thing that I would really like to know ... is ... what part of the code goes where? I mean, what part of the code goes in the Prefix ... what part goes in the Narrative and what part goes in the postfix? What is it that seperates them apart?