This article looks at how to use a local data source in a Web Intelligence report and then combine that data with data retrieved from a data warehouse.
The worked example described here is to create a simple dashboard style report of sales data. We then highlight the sales figures using a typical red, amber, green format based on whether a sales figure has met, exceed or failed to meet a defined target. While the sales data is extracted from a data mart our target values however are defined in a spreadsheet.
The screenshot below is of the final report and the following is a summary of the steps required to create this report,
- Create a new Web Intelligence document using Web Intelligence Rich Client
- Create a query of sales data from eFashion database.
- Create spreadsheet with required target value data
- Edit the Web Intelligence document and import this data
- Add a table at top of page to display the imported values
- Create Alerters to highlight sales figures using these values
- Save and export the document to the repository
- Test that refreshing the document only updates efashion data set and doesn’t try to refresh the spreadsheet data.
The screenshot below is the final version of the report as viewed in InfoView. The table at the top of the page displays the target values extracted from the spreadsheet. Below this is our sales data table where we’ve used Alerters to highlight sales figures in either red, amber or green depending on which target value the sales have met.
Note, although the instructions below are fairly detailed it is expected that you already have a good understanding of creating end editing documents using Web Intelligence.
This example uses the eFashion universe that is available in the samples that come with the default installation of SAP BusinessObjects Enterprise. You will need to have the eFashion universe deployed and connected to the eFashion database. See the SAP BOE Deployment Guide for further instructions on this.
The spreadsheet is created using Microsoft Excel however if you do not have access to Excel then you can use a plain text file instead for the local data source as the workflow is more or less the same.
Local data sources were introduced in the XI 3.1 version of SAP BusinessObjects Enterprise and it is this version that is used here.
Create a new Web Intelligence Document
First we create a new Web Intelligence document and create a simple query to retrieve sales data by store and year from eFashion universe.
- Launch Web Intelligence Rich Client and logon using any account that has access to the eFashion universe.
- From the initial screen select the option to create a new document using a universe and select the eFashion universe
- Create a simple query that selects Store name, Year and Sales revenue objects. Note, we don’t need any filters
- Run this query and we should see a report containing a simple table display sales revenues by store and year.
- Create a basic crosstab with stores in the vertical y-axis and years in the horizontal x-axis along the top with sales revenue in the body.
- Save your document to your local file system.
Your report should be similar to the following,
Make a note of the years and also make a note of the range of sales revenue values. A different version of the eFashion database may contain different years and sales amounts. When we create our red, amber and green target values (also known as RAG values) in the spreadsheet we need to ensure that these values are in the same range as the data in the report in order to demonstrate that the Alerters work correctly.
Create a Spreadsheet of Sales Target Values
In the screen shot the years are 2001, 2002 and 2003 and the sales revenue varies from about $200,000 to $1,600,000. So we create a spreadsheet that defines a different set of RAG values for each year. Note, we only need to define red and green values as amber is used for total sales value that lie between red and green
The table below displays some suitable values,
|Year||Red Value||Green Value|
To create the spreadsheet,
- Launch Excel and add the above table to a new spreadsheet file.
- Highlight the range of cells that this data occupies and define the name “RAG_DATA” for this range. You can do this by selecting Name from the Insert menu and then select Define from the sub menu. Your spreadsheet should be similar the screen shot below
- Save your spreadsheet to a suitable location such as your desktop or My Documents.
Using a Plain Text File as an Alternative
If you don’t have access to Excel then you can use a plain text file as an alternative. This text file can either be a fixed width or delimited data text file. Include column headings in the first row will make identifying the data in the Web Intelligence report easier. If you wish you can save the following to a text file on your local system,
"Year","Red Value","Green Value" "2001","500000","1000000" "2002","1000000","1500000" "2003","1200000","1700000"
Import RAG Data into the Document
Next we want to import this data into our Web Intelligence document.
- Return to Web Intelligence Rich Client
- Click Edit Query
- Click Add Query and select local data source
- Click Next and then click the Browse button in the next screen and select the spreadsheet we created above. Or if using a text file select your text file that you created.
- Having selected the Excel file we should be able to define where the data is within the Excel file. Select Range option and our range name should be listed in the drop down box.
- Leave the “first row contains column names” check box checked
Note, if you are using a text file then you’ll have a different configuration screen where you can specify the structure of the text file.
- Click Next and we should be presented with a local data query screen listing the column headings in our range and a sample of the data from the spreadsheet
- In the top panel of ‘Result Objects’ we see that each object is a measure. This is fine for the red and green value objects but for Year we want this to be a dimension. Select the Year object (in result object panel) and under object properties change the object’s qualification from Measure to Dimension.
- Also change the data type of the object from Number to String. This is so that we can use this object to merge this data with the eFashion data which we’ll do later.
Note, under Query Properties in the left hand side we have an option ‘Refreshable’. By default this is checked and unchecking this means that the query won’t be refreshed when the document is refreshed. Although this is what we want we have to leave this checked just now so that we run this query at least once to bring in the data. Later we’ll uncheck this option prior to exporting the document to the Repository.
- Also, to make things easier, we’ll rename this query to “Local Data Query” so we easily identify the data when working with the report.
- At this stage you may also want to rename our first query to “Sales Data Query”.
- From the Run Queries button click the down arrow and select Local Data Query to load the data from the spreadsheet into Web Intelligence.
- In the popup dialog select the option to Include the result objects without generating a table
- Save the document at this point.
Displaying Data In The Report
Now that we have imported the data we need to merge this data set with the data set from eFashion. We use the Merge Dimensions feature to do this.
- Click on the Merge Dimensions icon in the toolbar
- Using the control key select the Year object in both Available Dimension panels.
- Click Merge button
- Click OK to the Edit Merged Dimension dialog.
- Click OK to close the Merge Dimension window.
Note, earlier we changed the data type of the Year object in the local data source query from number to string. This is because Year object in the eFashion data set is of String data type and we can only merge dimensions that have the same data type. If we didn’t then we wouldn’t be able to select both dimensions in the Merge Dimension window.
We now have our data synchronised. This allows us to apply Alerters correctly based on the different red and green values for each year. Before we create our Alerters we’ll add a table to the report to display the RAG values.
Rather than just displaying the Red and Green values that we imported from the spreadsheet we will instead display a table that provides more descriptive text about the target ranges.
- Move the existing table further down the page so we have room to add the new table above
- Drag the objects Year, Red Value and Green Value from the list of objects to the report such that they create a table above the original table
- Make sure the columns are ordered Year, Red Value, Green Value and insert a new column between the Red and Green columns labelled ‘Amber Value’
- Update the cell that is display the data for the Red Value column and change it from =[Red Value] to =”Less than ” + [Red Value]
- Update the Green Value data cell and change this entry to =”Greater than ” + [Green Value]
- Add a new formula to the Amber Value column: =”Between ” + [Red Value] + ” and ” + [Green Value]
- Your report should now look similar to the screen shot below
Create RAG Alerters to Highlight Sales Data
- Select the Sales revenue cells in the crosstab
- Click the Alerters icon from the tool bar
- Click New
- Change name to “RAG alerter”
- In sub alerter area change the operator to Less Than
- Click the “…” button next to the value text box to select an object
- Select Red Value from list of objects and click ok
- Leave the cell format as red text
- Click Add Sub-Alerter button
- Change operator to greater than or equal to and then select the Red Value object again
- Click the plus button to add a new conditional row and in this row set operator to less than and select the Green Value object
- Click format button and set the text colour to orange
- Click Sub-Alerter once more, change operator to greater than or equal to and select the Green Value object
- Change format to green text
Your dialog should be similar to,
- Click OK to close the dialog box and
- Click OK again to return to the report
- Save your document
Our table should now contain data coloured accordingly to the Alerter values.
Export to Repository
Before we can export the document we must first disable the refresh of the local data. This is so that the we can refresh the report in InfoView against the eFashion database but not against the local data as the spreadsheet is not accessible by the server.
- Click the Edit query button
- Select the Local Data Query tab
- Under properties uncheck ‘Refreshable’
- Click down arrow on run queries button and click Sales Data Query (the eFashion query)
By running the Sales Data query we apply the changes and we return to the report. We do have an option under the close button to apply changes and close but this purges all data from the report which we don’t want.
- Save document and from the File menu select Export to CMS
- Select a suitable folder and click OK
- Logon to InfoView and open your document
- Click the drop down arrow on the Refresh button and the Local Data Source query should be greyed out.
- Click refresh should now only execute the eFashion query
This worked example looked at incorporating local data with enterprise data and using the local data to define target values. This is a fairly typical business scenario where we find actual figures contained in data marts but target values, which are not maintained by a system, are instead held in spreadsheets.
2 thoughts on “Using Local Data Sources in Web Intelligence”
Your blogs are really informative. Thanks for posting them.
This blog seems to be incomplete. Is there a part 2?
Hi, thanks. Yes it was incomplete – WordPress occasionally truncates a post, however I’ve now restored the full version. Thanks for letting me know!