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







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.