So you have created your SAC story with fully interactive visualisations and feeling proud of yourself. The next step in the process is to do a playback of the solution to the business and wait for those familiar words “That’s great …. but” and you hope and pray to whatever deity is currently available that the sentence after the “but” is close to achievable.
I was recently given one of those “buts” from a client when they asked me if we could include the current live exchange rates between currencies and also their company’s stock value as part of their story. After picking myself off the floor, my initial thoughts were “This is not possible”, however it turns out to be reasonably easy to do and in the remainder of this blog I am going to explain how to go about it.
You may or may not be aware of a brilliant website called TradingView, (www.tradingview.com). This website provides an overwhelming amount of information and analytical capability relating to the Stock Market and one very cool feature with the website is its abundance of free widgets that provide this information and these can be embedded into other third-party solutions and this is where SAC comes in.
For the purposes of this blog, let’s assume we want to include a widget that contains a Stock Ticker and Line Chart that tracks the GBP vs EUR performance over time in our Story.
The first thing we need to do is go to the TradingView website and look for the “Widget” section. (This can be found under the “More” option on main menu bar at the top of the webpage). Once in the widget section, scroll down until you find a section titled “Mini Chart Widget”. Select the “Get Widget” option and you will be presented with the screen below.
You are presented with a number of options and the first thing we want to do is change the symbol field so that it reports GBP vs EUR. Under Symbol field enter the value “GBPEUR” and you will be presented with two options as shown in the screen below. We now select the option that is appropriate for our use case.
Once we have changed the symbol we then click on the “Apply” option and the changes we have made will be reflected through on the chart. As you can see from the screen below, there are a number of options available which allow you to:
- determine how far back you analyse the exchange rate
- The colour theme you want to use
- The size
The widget is now ready to take into SAC but the question is, how do we get it into SAC?
To include the widget in SAC we need to make use of the Console in Chrome Developer Tools and to access this we can either press F12 or access the console by selecting the Chrome Options (Ellipses at the top right hand corner of Chrome) and choosing “More Tools” and “Developer Tools”. This should bring up a window shown in the screen below.
We want to select “Element” tab and this will display the HTML code that was used to build the webpage as shown below. As we hover over the code it highlights the corresponding elements on the webpage.
The easiest way to identify the element that makes up the widget that we want is to search for a specific container. To search select Ctrl + F to bring up the search bar and enter “iframe”. There could be several iframes in the code so look for the one that highlights the widget we want when you hover over it.
Now the eagle-eyed ones amongst you will notice within this container there is a URL and this is what we are looking for. The next step is to copy this URL and go back into our SAC story where we want to include the new widget.
Once in the SAC story, select the option to insert a “Web Page” as shown below.
Give the Web Page a Title and paste the copied URL into the “Web Page Address” entry. Once you have completed the fields hit Enter. Et Voila! We now have a stock chart widget in our story. Multiple stock widgets can be included in our story as shown in the screenshot below.
There is obviously a lot more you can do with these widgets such as styling, etc.
One very cool feature of these widgets is that they are live and they will update the information in real time whilst our Story is open.
TradingView (www.tradingview.com) is a fantastic website for providing stock exchange based information and offers a whole host of new and interesting widgets that can be utilised to bring much more to your SAP Analytics Cloud Story. TradingView are happy for their widgets to be included in third-party solutions.
This blog was originally created by myself and posted at the following: