Professional Documents
Culture Documents
Table of Contents
-----------------------------------------------------------------------------------------------
Version_______________________________________________
This document applies to the “Cognos_SDK_template” C# web solution and a sample Cognos 8.1 report
based on the GOSR package.
Disclaimer_______________________________________________
While every attempt has been made to ensure that the information in this document is
accurate and complete, some typographical errors or technical inaccuracies may exist.
BI Centre does not accept responsibility for any kind of loss resulting from the use of
information contained in this document.
This document shows the creation date, and the information contained within this
document is subject to change without notice.
No part of this document, or the included sample project, may be copied, photocopied,
reproduced, transmitted in any form or by any means, or translated into another
language without the prior written consent of the BI Centre.
Overview_______________________________________________
The Cognos SDK Guide by BI Centre is intended to provide a Cognos SDK developer with a workable C#
solution that will allow you to:
The Cognos SDK Guide by BI Centre will walk you through the steps of generating your ASP.NET C#
web solution and guide you through the process of creating your: ASP.NET pages; C# Class Files for
Exception handling and Cognos SDK method calls; supporting JavaScript code; deciding upon which
Cognos SDK DLLs to reference; and handling basic security by using the web.config.
The full source code has been provided for you and this step would be to cover the steps in order to
generate the solution’s project structure.
Let’s get started by building the sample file and folder structure for your solution:
You have now successfully created the main skeletal structure for your ASP.NET C#
solution.
The CognosSDK.cs class file is used primarily for interacting with your Cognos Content Store. You will
be adding methods that will enable you to: Authenticate and connect to the Cognos service; request and
return Cognos Content Store objects; request and set report parameter values; and execute a report.
Authentication
The CognosLogon() method handles the authentication to the Cognos Report Service. This method
permits a BIBus API value to be set and connected to Cognos 8. We have stored our authentication
values in our web solution’s web.config file. We’ll discuss how to retrieve these values in the section
named – web.config.
Here is the example code to authenticate a user to Cognos 8. The code is appending encoded xml with
the stored values from the web.config file. The Content Manager service’s .logon() method is passed the
encoded xml and it will return a valid CAMPassportId. If the user fails to be authenticated then an error
message is passed to a string variable, which can then be displayed to the end user.
The Cognos Content Store contains the metadata representation of items such as reports, query items,
report views, and security settings. The Cognos SDK code can call the Content Manager’s .query()
method to search for and retrieve Content Store items. The getObjects() method is an example of
searching the Content Store and finding either all Content Store package items or all report items for a
specified package.
public baseClass[] getObjects(contentManagerService1 _cmService, string
_path, string _package)
{
propEnum[] _props = new
propEnum[]{propEnum.searchPath,propEnum.defaultName,propEnum.objectClass,
propEnum.modificationTime, propEnum.connectionString, propEnum.creationTime,
propEnum.link, propEnum.specification, propEnum.version,
propEnum.defaultName, propEnum.portalPages, propEnum.ancestors,
propEnum.owner};
if(_cmService != null)
{
sort[] _sort = {new sort()};
_sort[0].order=orderEnum.ascending;
_sort[0].propName=propEnum.defaultName;
_packagePath = "/content//package/*";
_reportPath = "/content/package[@name='" + _package + "']/report//*";
Step-by-step_________________________________________________
Default.aspx
When the application is launched it loads all of the packages that exist within your Content Store into a
listbox control. You would select the desired package name from the list and then click the ‘Go To
Reports’ button.
Reports.aspx
After you selected your package you are then displayed a list of all of the report items
that exist within your specified package. In this case, we see two reports that are based
on the GOSR package. Remember, that the GOSR package is a demonstration
package provided by Cognos.
You would select the requested report from the listbox control and then click the ‘Execute Report’ button.
We have provided the Product Line report xml specification within the “Product Line report spec.txt” file
that is provided with your .NET solution.
PromptPage.aspx
The application renders your report’s prompt page and displays the user prompts to the
user. When the prompt control is highlighted red it means that a value must be selected
in order to satisfy your report’s prompt requirements.
In this scenario you must enter a value from the drop down list to provide a parameter value for the
product line prompt. Once you selected a value then you will click the ‘Finish’ button. If the ‘Finish’ button
is disabled, or grayed out, then you must confirm that you have successfully selected a prompt value from
the drop down list.
Output.aspx
After you have satisfied your report’s request for selecting a prompt value and click the ‘Finish’ button,
you are then displayed a message stating that the report is currently being executed.
Once the Cognos Report Service has been able to execute the report the results are
then displayed.
Contact for more information______________________________
If you have any questions or require assistance then be sure to check out BI Centre SDK Guide and BI
Centre for updates related to this code.