Creating a news ticker with Excel XML Maps

In this recipe, we will show you how to integrate a real-time news ticker into your dashboard. The user will then be able to click on a news article and the website will automatically pop up. To set up this connection to an online news website, we will use the Excel XML Maps connection.

Getting ready

Make sure the spreadsheet has a DEVELOPER tab, and that you are connected to the Internet.

Getting ready

If you do not see the DEVELOPER tab, please follow these instructions:

  1. Click on FILE.
  2. Click on Options.
  3. Click on Customize Ribbon.
  4. Check the DEVELOPER box.
    Getting ready

How to do it...

  1. Go to http://www.cnn.com/. At the bottom of this page, you will see an RSS link. You can also directly go to http://www.cnn.com/services/rss/.
  2. Copy the URL of the Top Stories RSS feed: http://rss.cnn.com/rss/edition.rss.

    Note

    RSS is an XML-based method by which web content can be easily and quickly distributed when it is changed or newly entered into a website.

  3. Open a new SAP BusinessObjects Dashboards file, go to the DEVELOPER tab, and click on Source. The XML Source pane will appear.

    Note

    If you are using MS Excel 2003, you can find the XML Source pane at Data | XML | XML Source.

    How to do it...
  4. Click on the XML Maps... button.
  5. In the upcoming XML Maps window, click on the Add... button.
  6. Paste the RSS URL into the File name field and click on Open. A message might appear stating that this XML source does not refer to a schema and Excel will create one itself. Click on OK.
    How to do it...
  7. Click on OK once more in the XML Maps window to close it. The XML Source window will now show all the fields that are available in this RSS stream.
  8. To create a news ticker we only need two of these fields: the title of the article and the URL to the article on the CNN website. Both fields are located in the item folder: title and link. Click and drag the title field to cell A6 and drag the link field to cell B6.
    How to do it...
  9. Hit the Refresh Data button in the DEVELOPER tab. The cells below A6 and B6 will now be filled with data from the RSS feed.
    How to do it...
  10. Open the Data Manager as shown in the following screenshot:
    How to do it...
  11. Click the Add button and select Excel XML Maps. You can find this connection type in the Existing Connections area.
  12. As you can see, the Data Manager has already picked up the RSS feed we added to the spreadsheet.
    How to do it...
  13. Go to the Usage tab. Select Refresh Before Components Are Loaded. Also, set Refresh Every to 1 Minutes. Close the Data Manager.
    How to do it...
  14. Add a Ticker component from the Selectors category to the canvas.
  15. Bind its Labels to cells A7:A16.
  16. Select Insertion Type as Row. Bind the Source Data field to cells B7:B16. Bind the Destination field to cell B4.
    How to do it...
  17. The next steps explain how to trigger the website popup. Add a URL Button component to the canvas.
  18. Bind the URL field to cell B4.
  19. Empty the Label field.
  20. Go to the Behavior tab, bind the Trigger Cell field to cell B4, and ensure that the When Value Changes option is checked.
    How to do it...
  21. Finally, go to the Appearance tab and deselect the Show Button Background option. The URL Button component should now be invisible.
  22. Try your dashboard!
    How to do it...

How it works...

Let's recap what we just did. First, we added an RSS feed from http://www.cnn.com/ to our spreadsheet. We used the standard Excel XML Maps functionality to do this. A big advantage of this method is that we can preview the data directly in the spreadsheet, which eases the setup of components and data bindings.

Next, we created a data connection in the Data Manager. This step is necessary to let SAP BusinessObjects Dashboards know where to get the data from and under what conditions (refresh rate). If we do not do this, the dashboard will not get fresh data from the RSS feed and will only use the data that is already stored in the spreadsheet cells.

We bound a Ticker component to the cells containing the titles of the news stories. If the user clicks one of the titles, a web page should open with the right story. We set up row insertion to fetch the right URL for the URL Button. Finally, we configured the URL Button component so it would be triggered without clicking it.

There's more...

In this section, we will take a look at the Usage tab under Data Manager | Connections, as well as the Connection Refresh Button component.

Usage tab

Most connection types in the Data Manager have a Usage tab like we saw in step 13 of the recipe. There are two sections in this tab: Refresh Options and Load Status.

With Refresh Before Components Are Loaded the data connection will be used to get data as soon as the dashboard starts. The Refresh Every option sets the refresh rate in seconds, minutes, or hours. You can also choose to refresh the data when a value in a particular spreadsheet cell changes or a certain value is matched.

During the loading of fresh data it is possible to inform the dashboard user what is happening at the moment (loading data or idle). You can insert these messages in a spreadsheet cell and display them, for example, with a Label component. Also, a nice idea is to display a loading-image instead of text. You can use Dynamic Visibility to set this up (see Chapter 4, Dynamic Visibility).

If you select the Enable Load Cursor option, the cursor will change from the standard arrow into an hourglass. The Disable Mouse Input on Load option will disable user interactions (mouse clicks and mouseovers) as long as data is being loaded.

Usage tab

Connection Refresh Button

To manually refresh data when using the dashboard, we can use the Connection Refresh Button component, which can be found under Web Connectivity. This component can refresh one or more connections that are defined in the Data Manager.

Connection Refresh Button
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset