Buy the Cognos SDK Guide by BI Centre Now

The Cognos SDK Guide by BI Centre provides you with the complete source code for a C# web solution, C8.1 report based on the GOSR package, and a Word document that will serve as your core reference to understanding the Cognos 8 SDK. It will cover C8 SDK topics such as: authentication; querying the Cognos content store; rendering a C8 report in ASP.NET; exception handling; and much more.



Buy the Cognos 8 Modification Check Now







Saturday, January 23, 2010

Do you have Cognos 8 SDK issues?

Hello, you can let us know what your Cognos 8 SDK issues and we'll be more than happy to assist you. We offer short or long term remote consulting services to help you with your Cognos 8 SDK project.

Do you need support with your Cognos 8 SDK project? If so, then email us today at businessintelligencecentre@gmail.com.

Wednesday, October 7, 2009

Unleashing the Power of IBM Cognos SDK

Unleashing the Power of IBM Cognos SDK

By Deepesh K. Shrivastava, Wipro Technologies

With increasing use of BI, users want quick access to information. BI is increasingly becoming pervasive across the organization. This demands BI capabilities embedded across different business functions and delivery portals. It also requires intuitive, easy to use user interfaces. In such cases, when deployment of BI capabilities is not just limited to trained analytical or power users; and BI offering require better usability, adherence to corporate branding look & feel standards, or integration along with other business functions like ordering, IBM Cognos SDK capabilities comes to rescue.

IBM Cognos SDK is a very powerful toolset to extend capabilities of the Cognos platform and for providing different integration & deployment options. Cognos SDK is built using industry standard protocols SOAP, WSDL.

Wipro's 'Customer Self-Service BI' framework has been built over the IBM Cognos SDK and provides simplified interface to SDK services as façade. This framework also integrates other Web 2.0 functions including AJAX.

When it comes to customer facing applications, organizations have elaborate set of branding look & feel requirements and any customer facing BI is not exception to it. Such solutions also require high level of scalability and intuitive usability. Organizations also wants any such BI offering to be made available within their e-commerce portal and at times, wants BI functions to be embedded alongside other business functions.

'Customer Self-Service BI' framework leveraging IBM Cognos SDK offers seamless integration possibility and leverages organizations existing investment into any branded e-commerce portal. Following are the key components of such integration –

  • Corporate portal or web application
  • 'Customer Self-Service BI' framework
  • IBM Cognos SDK
  • IBM Cognos BI platform


--
BI CENTRE
http://bicentre.blogspot.com


Wednesday, July 1, 2009

Remote Cognos Development Opportunity

Does your organization require temporary support doing Cognos development? If so, then the BI Centre can give you that short term, or long term, support to help you meet your deliverable.

We can assist with model development, report development, SDK coding, testing, QA, technical documentation and even project management.

Feel free to contact us today to discuss your needs.

email: businessintelligencecentre@gmail.com

Monday, November 24, 2008

SDK - SSO for Series 7 gateway namespace using CSharp

using System;
using System.Collections;
using System.Web.Services;
using cognosdotnet_2_0;


namespace SetCredential
{

///
/// Summary description for Class1.
///

class SetCredential
{
private cognosdotnet_2_0.CognosReportNetBinding oCrn = null;

propEnum [] props = {propEnum.defaultName, propEnum.searchPath};

public SetCredential(string endPoint)
{
oCrn = new CognosReportNetBinding();
oCrn.Url = endPoint;
oCrn.Credentials= System.Net.CredentialCache.DefaultCredentials;
}


//
// get a list of the packages for the logged in user
//
public void getPackageList()
{
try
{
baseClass [] objInMyFolders = oCrn.query("//package",
props, new sort[]{}, new queryOptions());

int temp = 1; // If you've made it to here, SSO is working. Examine objInMyFolders to see the packages
}
catch (Exception e)
{
Console.Write("\n" +e.GetBaseException());

}
}

///
/// The main entry point for the application.
///

[STAThread]
static void Main(string[] args)
{
String endPoint = "http://localhost/c84GA/cgi-bin/cognos.cgi";
SetCredential packageList = new SetCredential(endPoint);
packageList.getPackageList();
}
}
}

SDK - Bad version number in .class file

http://bicentre.blogspot.com/2008/11/sdk-bad-version-number-in-class-file.html

Monday, June 2, 2008

Access Manager LDAP -- add new user

Authenticator2.Application _AuthApp = new Authenticator2.Application(); Authenticator2.Document _AuthDoc; Authenticator2.DSConfigurations objDSConfigs; Authenticator2.Configuration objConfig; objDSConfigs = ((Authenticator2.DSConfigurations)_AuthApp.DSConfigurations); objConfig = ((Authenticator2.Configuration)objDSConfigs.Add("cognosserver",389,"dc=dev",0)); objConfig.DefaultSecuritySource = true; _AuthDoc = ((Authenticator2.Document)((Authenticator2.AuthenticatorDocuments)_AuthApp.Documents).OpenWithBasicSignon("default","administrator","mypassword","Root User Class")); Authenticator2.User objUser; objUser = ((Authenticator2.User)((Authenticator2.Users)((Authenticator2.Folder)_AuthDoc.UserFolder).Users).Add("MyNewUser")); //clean up System.Runtime.InteropServices.Marshal.ReleaseComObject(_AuthDoc); System.Runtime.InteropServices.Marshal.ReleaseComObject(_AuthApp);

Monday, May 12, 2008

New C8 SDK Utility --- Cognos 8 Modification Check

The BI Centre C8 Modification Check provides a Cognos SDK developer with a workable C# solution that will allow you to:

· Search the Content Store for items that have been modified after a selected date value

For example, if you were looking for all reports that were modified on June 3rd, 2008 then you would select the date June 2nd, 2008. The code will search for all items that have been modified after the selected date value from the date control.

The results of the search are then rendered to a text box control.






Friday, May 2, 2008

next Cognos SDK utility

We are currently working on a Cognos SDK utility that will return query a namespace to return all of the groups, users and their assigned privileges. The results will be added to .txt file.

Email us today if you would like to be notified when this utility has been completed.

Saturday, April 12, 2008

Cognos 8 SDK -- ContentManagerService passing authentication

If the logon was successful, the ContentManagerService becomes an authenticated service and a string known as a CAM Passport will be sent back to the SDK application in the BiBusHeader. When an SDK application creates an object to represent a Cognos 8 service, that object will contain a property called BIBusHeader. The BIBusHeader represents the SOAP header that is used to communicate with the Cognos 8 server. Within the BIBusHeader, is a property named CAM which in turn contains a property named CAMPassport. The CAM Passport returned by the logon() method is stored in the
CAMPassport property.

In an SDK application, the CAM Passport does not automatically propagate to other services that might be used within the application. Since the ContentManagerService is the only service than can logon and logoff, there needs to be ability to assign the CAM Passport to other services that the SDK application might require (such as the ReportService). This assignment is done simply by copying the BIBusHeader of the ContentManagerService to the BIBusHeader of the other service, thereby making that service an authenticated service.

Cognos 8 SDK -- Logging on

Unless Anonymous access is allowed, when a Cognos 8 SDK application is connected to the Cognos 8 server the application has no implied rights or access permissions. The Cognos 8 SDK application needs to login just as a general user would login to the Cognos portal.

If anonymous access is allowed, the Cognos 8 SDK application will be granted the same rights and permissions as the Anonymous user from the Cognos namespace. If anonymous access is not allowed and a Cognos 8 SDK application does not login, an exception will occur when the SDK application tries to perform an action such as querying the content store or running a report.

All logons and logoffs are performed through the ContentManagerService using the logon() and logoff() methods. None of the other Cognos 8 services can perform a logon or logoff operation.

Sunday, March 2, 2008

Cognos 8 SDK -- example of capturing reporting history

private boolean reportJobStatus()
{
boolean blnError = false;
Vector reportHistories = getReportHistories();
String reportName = "";

PropEnum props[] = new PropEnum[]{PropEnum.searchPath, PropEnum.defaultName, PropEnum.detail, PropEnum.detailTime, PropEnum.severity};
Sort sort = new Sort();
sort.setOrder(OrderEnum.ascending);
sort.setPropName(PropEnum.defaultName);
Sort[] sortOrder = new Sort[]{sort};

try
{
if(reportHistories.size() > 0)
{
for(int i =0; i < reportsearchpath =" (String)reportHistories.get(i) + "//historyDetail";
reportName = getReportName(reportSearchPath);
BaseClass bc[] = cmService.query(new SearchPathMultipleObject(reportSearchPath ), props, sortOrder, new QueryOptions());
if(bc != null && bc.length > 0)
{
for(int j =0; j < historydetail =" (HistoryDetail)bc[j];" blnerror =" true;">" + reportName + "" +
" " + historyDetail.getDetailTime().getValue().getTime() + "" +
" " + historyDetail.getDetail().getValue() + "";
}
}

}
}
}
}
catch(Exception e)
{ System.out.println("RunJobNowAndCaptureError::reportJobStatus()");
e.printStackTrace();
}
return blnError;
}

Monday, February 25, 2008

Cognos SDK -- cube drill down

Here is a C# Cognos SDK code snippet that shows the ability to drill down into a cube report by using the Cognos SDK.  Take note of the bolded code lines below.  You will need to use the Report Service's .drill method and pass in values for the drillOptionParameterValues property.
 
simpleParmValueItem item = new simpleParmValueItem();
                item.use = "[great_outdoors_company].[Years].[Years].[Year]->:[PC].[@MEMBER].[20050101-20051231]";
                item.inclusive = true;
 
option[] drillOptions = new option[1];
                drillOptionParameterValues d1 = new drillOptionParameterValues();
                d1.name = drillOptionEnum.down;
                d1.value = parameters;
                drillOptions[0] = d1;
 
response = this.rptService.drill(response.primaryRequest, parameters, drillOptions);
 
 
 
 
private void GoToDrillDown(reportService1 rptService)
        {
            if (this.rptService == null)
            {
                this.rptService = rptService;
            }
            String reportPath = "/content/package[@name='Great Outdoors Company']/report[@name='MyTestReport']";
           String savePath = "c:\\temp";
            parameterValue[] parameters = new parameterValue[1];
            asynchReply response;
            searchPathSingleObject reportPathObj = new searchPathSingleObject();
            reportPathObj.Value = reportPath;
            try
            {
                option[] runOptions = new option[6];

                runOptionBoolean saveOutput = new runOptionBoolean();
                saveOutput.name = runOptionEnum.saveOutput;
                saveOutput.value = false;
                runOptions[0] = saveOutput;

                // Specify the output format.
                runOptionStringArray outputFormat = new runOptionStringArray();
                outputFormat.name = runOptionEnum.outputFormat;
                outputFormat.value = new String[] { "HTML" };
                runOptions[1] = outputFormat;

                //Set the report not to prompt as we pass the parameters if any
                runOptionBoolean rop = new runOptionBoolean();
                rop.name = runOptionEnum.prompt;
                rop.value = false;
                runOptions[2] = rop;

                runOptionInt maxRows = new runOptionInt();
                maxRows.name = runOptionEnum.verticalElements;
                maxRows.value = 20;
                runOptions[3] = maxRows;

                option[] drillOptions = new option[1];
                drillOptionParameterValues d1 = new drillOptionParameterValues();
                d1.name = drillOptionEnum.down;
                d1.value = parameters;
                drillOptions[0] = d1;

                //Set the option to always have the primaryRequest in the response
                asynchOptionBoolean includePrimaryRequest = new asynchOptionBoolean();

                includePrimaryRequest.name = asynchOptionEnum.alwaysIncludePrimaryRequest;
                includePrimaryRequest.value = true;
                runOptions[4] = includePrimaryRequest;

                runOptionLanguageArray roOutputFormat = new runOptionLanguageArray();
                roOutputFormat.name = runOptionEnum.outputLocale;
                String[] fmt = { "en-us" };
                roOutputFormat.value = fmt;
                runOptions[5] = roOutputFormat;

                //Run the report
                response = this.rptService.run(reportPathObj, new parameterValue[] { }, runOptions);
                //If response is not immediately complete, call wait until complete
                if (!(response.status == (asynchReplyStatusEnum.complete)))
                {
                    while (!(response.status == asynchReplyStatusEnum.complete))
                    {
                        //before calling wait, double check that it is okay
                        if (hasSecondaryRequest(response, "wait"))
                        {
                            response =
                             this.rptService.wait(
                               response.primaryRequest,
                               new parameterValue[] { },
                               new option[] { });
                        }
                        else
                        {
                            Console.Write("Error: Wait method not available as expected.");
                            return;
                        }
                    }
                    //check if output is ready

                    if (outputIsReady(response))
                    {
                        response =
                         this.rptService.getOutput(response.primaryRequest, new parameterValue[] { },
                          new option[] { });
                    }
                    else
                    {
                        Console.Write("output is not ready!");
                    }
                }

                String data = getOutputPage(response);
                // Write the report output to file system
                Console.Write("Writing the output of the original report..");


                StreamWriter sw = File.CreateText(savePath + "\\original.html");
                sw.Write(data);
                sw.Flush();
                sw.Close();


                //Drill down in the report
                //set up drill down parameter.
                simpleParmValueItem item = new simpleParmValueItem();
                item.use = "[great_outdoors_company].[Years].[Years].[Year]->:[PC].[@MEMBER].[20050101-20051231]";
                item.inclusive = true;

                parmValueItem[] pvi = new parmValueItem[1];
                pvi[0] = item;

                parameters[0] = new parameterValue();
                parameters[0].name = "Year";
                parameters[0].value = pvi;

                response = this.rptService.drill(response.primaryRequest, parameters, drillOptions);

                if (!(response.status == (asynchReplyStatusEnum.complete)))
                {
                    while (!(response.status == asynchReplyStatusEnum.complete))
                    {
                        //before calling wait, double check that it is okay
                        if (hasSecondaryRequest(response, "wait"))
                        {
                            response =
                             this.rptService.wait(
                               response.primaryRequest,
                               new parameterValue[] { },
                               new option[] { });
                        }
                        else
                        {
                            Console.Write("Error: Wait method not available as expected.");
                            return;
                        }
                    }
                    //check if output is ready

                    if (outputIsReady(response))
                    {
                        response =
                         this.rptService.getOutput(response.primaryRequest, new parameterValue[] { },
                          new option[] { });
                    }
                    else
                    {
                        Console.Write("output is not ready!");
                    }
                }

                data = getOutputPage(response);
                // Write the report output to file system
                Console.Write("Writing the output of the drill down report..");


                StreamWriter sw2 = File.CreateText(savePath + "\\drilldown.html");
                sw2.Write(data);
                sw2.Flush();
                sw2.Close();


                // release the conversation to free resources.
                this.rptService.release(response.primaryRequest);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message.ToString());
                Console.WriteLine(ex.StackTrace);

            }
        }

Tuesday, February 19, 2008

Cognos 8 SDK -- prompt page with optional parameters

If you need to execute a Report Studio report that has optional parameters defined on the prompt page then you should code your Cognos SDK application to pass an empty parameter instead of an empty string.


// parameter values
ParmValueItem pvi[] = new ParmValueItem[1];

// If you pass an empty string to an optional parameter
// it will assume that you want to match an empty string in
// the filter. To get the desired behaviour, pass an empty
// parameter value
if (!inputValue.equalsIgnoreCase("")) pvi[0] = item1;

// Assign the values to the parameter.
params[i] = new ParameterValue();
params[i].setName(prm[i].getName());
params[i].setValue(pvi);

Thursday, February 14, 2008

display the contents of a folder in the Public Folder using C# and SDK

Here is the content store request in order to find all of the reports that exist under a specified folder.

baseClass[] bc = crn.query( "/content/folder[@name='ABCDEFG']//report", props, s, qo );

Tuesday, February 12, 2008

Cognos SDK Guide by BI Centre Sample?

Hello, did you want to have a quick preview of the guide before purchasing? If so then send us an email requesting your free sample of the guide today.

Saturday, February 2, 2008

Output.aspx.cs -- Displaying the report results

Now that the end user is able to interact with the report’s prompt page we need to execute the report and display the report values to our Output.aspx page. The Output.aspx.cs logic will contain a reference to the CognosSDK.cs function named resolvePrompts(). This function is used to determine the prompt type and prompt value that was executed on the report’s prompt page. These parameter values are then used to satisfy the parameter value collection that is passed in to the executeReport().


try
{
_frmData = Request.Form;
_selectedPkg = _frmData.GetValues("hidPkgName").GetValue(0).ToString();
_selectedRpt = _frmData.GetValues("hidRptName").GetValue(0).ToString();
_path = "/content/package[@name='" + _selectedPkg + "']/report[@name='" + _selectedRpt + "']";

asynchDetail[] _paramDetail = _cogSDK.GetParams(_selectedPkg,_selectedRpt,_rptService);
asynchDetailParameters _params = (asynchDetailParameters)_paramDetail[0];
int _pCount =_params.parameters.Length;

parameterValue[] _pv = _cogSDK.resolvePrompts(_frmData, _pCount);
string[] reportFormat = {"HTML"};

strHTML = _cogSDK.executeReport(_path, _pv, _rptService, reportFormat, false);
Response.Write(strHTML);
}

catch(Exception ex)
{
_ErrMsg = ex.Message.ToString();
Response.Write(_ErrMsg);
}

return;



We have already seen that the executeReport() will return a string variable value of the report’s output. This is achieved by applying an asynchReply variable to the Report Service’s .run() method.

try
{
spSingle.Value = reportSearchPath;
asynchReply C8reply = reportService.run(spSingle, pv ,arrRunOpts);

if (C8reply != null)
{
strHTML = getOutputPage(C8reply);

return strHTML;
}

else
{
return null;
}

}
catch (SoapException exSoap)
{
ExHandler exCognos = new ExHandler(exSoap);
return _ErrMsg = exCognos.Details + " :-: " + exCognos.Message + " :-: " + exCognos.Severity + " :-: " + exCognos.ErrorCode;
}
catch (Exception ex)
{
return _ErrMsg = ex.Message.ToString();
}


Output.aspx.cs will finally pass this string value to the page’s Reponse.Write() and render the dataset to the end user.

Thursday, January 24, 2008

Run a report with prompts -- CognosSDK.cs

Our working sample includes Report Studio reports that all contain prompts. In order for the reports to be executed they need to have their prompt page parameter objects populated with a valid parameter value. In order to achieve this we need to display the report's prompt page to the end user so that they can enter the prompt value into the appropriate prompt control. The approach that we will use to render the report's prompt page to the end user is to execute the selected report and satisfy the method's signature with an empty parameter value collection. Passing in an empty parameter value collection forces the Report Service to place the request into a 'prompting' status. We can then retrieve the request's HTML representation of the report's prompt page, and then render this HTML string to the ASP.NET page.



Note that our executeReport() method is looking for a Boolean value to state whether or not to prompt. When we want the prompt page then we set this Boolean value to True.



public string executeReport(string reportSearchPath,parameterValue[] pv, reportService1 reportService, string[] strFormat, bool blnPrompt){



………… method body………

…………

…………

}





The executeReport() method contains an asynchReply variable that is used to capture the conversation context of the request.



asynchReply C8reply = reportService.run(spSingle, pv ,arrRunOpts);





We will then pass the C8reply variable as an input parameter to the getOutputPage() method. This method will be used to populate a string variable with a string representation of the prompt page's HTML. It is this value that is written to PromptPage.aspx and displays the report's prompt page to the end user.



strHTML = getOutputPage(C8reply);





public string getOutputPage(asynchReply response)

{

asynchDetailReportOutput reportOutput = null;



try

{

for (int i = 0; i < response.details.Length; i++)

{

if (response.details[i] is asynchDetailReportOutput)

{

reportOutput =

(asynchDetailReportOutput)response.details[i];

break;

}

}

}

catch (SoapException exSoap)

{

ExHandler exCognos = new ExHandler(exSoap);

return _ErrMsg = exCognos.Details + " :-: " + exCognos.Message + " :-: " + exCognos.Severity + " :-: " + exCognos.ErrorCode;

}



//text based output is split into pages -- return the current page

return reportOutput.outputPages[0].ToString();

}



Before we display the prompt page to the end user we want make some modifications to the HTML that was returned. Our CustomizeHTML() helper function is used to update the HTML in order to work with our sample web solution. The main change will involve adding our own customized finish button to the prompt page to control the form's submission to Output.aspx. This will also enable us to add our own JavaScript function to the button's onClick() event. This is achieved in the CognosSDKHelper.js file.

Cognos 8 SDK google search

Google

New C8 SDK Utility --- Cognos 8 Modification Check

The BI Centre C8 Modification Check provides a Cognos SDK developer with a workable C# solution that will allow you to:

· Search the Content Store for items that have been modified after a selected date value

For example, if you were looking for all reports that were modified on June 3rd, 2008 then you would select the date June 2nd, 2008. The code will search for all items that have been modified after the selected date value from the date control.

The results of the search are then rendered to a text box control.