|
Blogs
Update: added sample codes for .NET InfoView as well as for Java InfoView. IntroductionBusinessObjects Enterprise XI 3.1 Service Pack 2 introduces new APIs that a developer may use to extend the usability of Web Intelligence. Last time, I blogged about the Web Intelligence Calculation Extension Points, an API for creating new custom functions for use in Web Intelligence documents. In this blog, I'll briefly describe the Web Intelligence Interactive Viewing Extension and Integration Points API. This link will direct you to a download page, where you can obtain documentation and samples for this API, as well as for the Web Intelligence Java Reporting Panel (JRP) and Rich Client (WRC) Extension Points. I previously wrote about the JRC+WRC Extension Points in my blog Integrate Google Maps with the Web Intelligence Rich Client. Where that extension allows for enhancements to the Java-based JRP and WRC UI, the Interactive Viewing extension allows for enhancements to the DHTML-based Interactive Viewer. Both extensions are Innovation Center prototype geared towards OEM/Partner customers for integrating and extending the Web Intelligence Viewers and Editors. Although full support is provided only for OEM/Partners, the APIs are available without any additional downloads, and the download link for the docs contain an Evaluation License to allow other developers to "check out" the functionality. The Interactive Viewing extensions consist of JavaScript and HTML code run client-side to add to the viewer UI, and Java or .NET code run server-side to access the ReportEngine SDK (Java or .NET) used in the processing of the document for viewing and editing. Access to ReportEngine - with its report creation/modification capabilities - means much of the features available in the Interactive Viewer and Editor are accessible through this API. With this extension, you can programmatically access the structure of the Web Intelligence document being viewed - its tables, charts, data providers, and even its internal data sets. You can programmatically remove components of the viewer you don't prefer to expose to clients, and add your own - toolbar buttons and "Left Panel" tabbed panes. You can even integrate components of the viewer into your own custom web application. Let's walk through a simple code example that uses this extension - I'll integrate Google Maps into the Interactive Viewer. Integrating Google Maps - A WalkthroughHere's a screenshot of the results: When you click on the "G" button in the toolbar, a JavaScript callback function invokes a JSP page, that invokes ReportEngine to introspect the Data Provider of the Web Intelligence document. It seeks out columns named "City" and "State", then dynamically creates JavaScript for creation of a Combo Box selection control in a pop-up dialog box. The Combo Box is filled with all the City+State values and selection of a value posts back to a JSP page that invokes JavaScript using the Google Maps API to display the location of the selected City + State. Installation of XI 3.1 Service Pack 2To use the Interactive Viewer extensions, you must have BusinessObjects Enterprise XI 3.1, and you must install Service Pack 2 on top of it. Modification of the webiviewer.properties fileIn the Java Web Application AnalyticalReporting, open the file AnalyticalReporting/WEB-INF/classes/webiviewer.properties file, and set the "ALLOW_CUSTOMIZATION" property to equal "yes". This enables the DHTML extensions. Modification of the user.js fileAn Extension Point customization is declared and triggered by addition of JavaScript code to the file AnalyticalReporting/viewers/cdz_adv/user.js. Here is the user.js file I use: user.js This file specifies that this extends the Toolbar ("MENUBAR") by addition of a button, where the button image may be found at AnalyticalReporting/viewers/cdz_adv/customize/samples/Menu_Bar/google_maps_icon.png (I just downloaded Google's icon, trimmed and resized to fit on the toolbar). Clicking on the button pops up a "popupWindow" of size 600x400, where the pop-up window calls back to the JSP page AnalyticalReporting/viewers/cdz_adv/customize/samples/Menu_Bar/googleMaps.jsp. The Interactive Viewer context - including such info ass the ReportEngine document storage token - is configured to be appended to the postback to googleMaps.jsp as HTTP GET parameters. Create the postback Java Server PageI made just a few modifications to the Yahoo! Financial sample code found in the documentation+sample download linked above to create this JSP page. The googleMaps.jsp page is given here (please Select All Ctrl-A then Copy Ctrl-C, and then Paste Ctrl-V to a text editor, for ease of reading). googleMaps.jsp This page retrieves the document storage token from the HTTP Request, then retrieves the Web Intelligence document being displayed in the viewer via the ReportEngine. It then introspects the Data Provider for City+State data, and generates HTML with JavaScript that creates a Combo Box with the location data. The JavaScript function comboCB then calls back to the JSP page AnalyticalReporting/viewers/cdz_adv/customize/samples/Menu_Bar/maps.jsp with the location appended as a HTTP Get parameter whenever a selection is made. Create the Google Maps API pageThe maps.jsp contains the Google Maps API JavaScript code: maps.jsp This merely retrieves the location information from the HTTP Request, then triggers a JavaScript client-side that invokes Google Maps, geolocates the position, then centers the map around that position. Note that the "key" code in this page is tied to my domain - you'll have to go to the Google Maps API site, and generate a key for your own domain. Create a Web Intelligence document with City and State columns in the QueryNow, create a Web Intelligence document off of the eFashion Universe, where you include the Store City and Store State objects in the Query. Restart your Java Web Application Server, flush cache on your web browser (to ensure you're retrieving the modified JavaScript files), log onto Java InfoView, ensure you've configured your User Preferences for the Interactive Viewer and Editor, and navigate to the Web Intelligence doc you've just created. .NET InfoView Samples CodesHere I'll present equivalent sample code files for .NET InfoView. First, you enable the Interactive Viewer Extension Point by editing the file: <Enterprise INSTALL>\Web Content\InfoViewApp\AnalyticalReporting\Web.config The JavaScript file <Enterprise INSTALL>\Web Content\InfoViewApp\AnalyticalReporting\Viewer\customize\user.js is modified to point to the ASPX files deployed to the folder <Enterprise INSTALL>\Web Content\InfoViewApp\AnalyticalReporting\Viewer\customize/samples/Menu_Bar/ where the files are: user.js
googleMaps.aspx
maps.aspx SummaryWith a couple of pages of code, I was able to create a very simple Proof-of-Concept that integrates Google Maps into the Interative Viewer. There's certainly room for improvements, of course! I'll leave that up to you... Next time, I'll blog about the Web Intelligence Custom Data Provider Plugins, another very exciting API new with Service Pack 2.
Ted Ueda
| |||||||||||||||||||||||