Purchase your Section 508 Compliance Support guide now!

Purchase your Section 508 Compliance Support guide now!

Cognos Connection -- disable email attachments

If you are dealing with your server being bogged down because users are emailing reports and sending them as attachments, then you may want to investigate disabling this option.  You would be required to modify the system.xml file [ BACKUP BEFORE CHANGING!!!].  You can hide the “Include Report” check box as an option for the end user to select.  This change will apply to all users.

 

The steps to perform this are:

 

1.  Stop the Cognos 8 service from within Cognos Configuration

2.  Back up the System.xml file located in …C8 install path/templates/ps/portal/.  Open the system.xml file in an XML or text editor.

3.  Add the following XML code to the <system> element:

                  <param name="ui_hide"> 
                                      <CC_RUN_OPTIONS_email_attachment/> 
                                        </param>

If you hide other user interface elements by modifying the system.xml file, the <param name="ui_hide"> element already exists. In this case, add the following to the element:

 <CC_RUN_OPTIONS_email_attachment/>

4.  Save the System.xml file.

5. Restart the Cognos 8 service from within Cognos Configuration.

Cognos Connection -- disable email attachments

If you are dealing with your server being bogged down because users are emailing reports and sending them as attachments, then you may want to investigate disabling this option.  You would be required to modify the system.xml file [ BACKUP BEFORE CHANGING!!!].  You can hide the “Include Report” check box as an option for the end user to select.  This change will apply to all users.

 

The steps to perform this are:

 

1.  Stop the Cognos 8 service from within Cognos Configuration

2.  Back up the System.xml file located in …C8 install path/templates/ps/portal/.  Open the system.xml file in an XML or text editor.

3.  Add the following XML code to the <system> element:

                  <param name="ui_hide"> 
                                      <CC_RUN_OPTIONS_email_attachment/> 
                                        </param>

If you hide other user interface elements by modifying the system.xml file, the <param name="ui_hide"> element already exists. In this case, add the following to the element:

 <CC_RUN_OPTIONS_email_attachment/>

4.  Save the System.xml file.

5. Restart the Cognos 8 service from within Cognos Configuration.

Cognos 8 SDK Validation Tool (Java and C#)

The Cognos 8 SDK can be used to validate your report schemas.  This will allow you to specify a path and validate all reports instead of individually validating a report from within Cognos Report Studio.

 

Cognos provides a sample Cognos SDK Java application that you can modify from the command line, OR you can convert it to C# code and try it yourself!

 

In order to get started you must:

1.      download the tool at http://support.cognos.com/supported/supportlink/techniques/ta_0612_03.zip.  

2.      modify the file “BuildValidateCognos8.bat” to match your environment for the “JAVA_HOME” and “CRN_HOME” environment variables. (NOTE:  I had to rename the file to .txt in order to update it)

3.      modify the file “RunValidateCognos8.bat” to match your environment’s dispatcher value

4.      execute the “BuildValidateCognos8.bat” and then execute “RunValidateCognos8.bat”

5.      provide your namespace and login credentials

6.      select “Y” to validate all reports that are found in your Cognos content store

7.      review the genereated Reports.txt, validate_log.log, and validate_results.log.

 

I use this approach as a safety measure to validate my reports whenever we are packaging our Cognos deployment package for any migration.

 

In another post I’ll discuss how can we do this Cognos SDK validation by using C#, and applying this logic prior to a form request when called within your Cognos SDK application.

Cognos 8 SDK Validation Tool (Java and C#)

The Cognos 8 SDK can be used to validate your report schemas.  This will allow you to specify a path and validate all reports instead of individually validating a report from within Cognos Report Studio.

 

Cognos provides a sample Cognos SDK Java application that you can modify from the command line, OR you can convert it to C# code and try it yourself!

 

In order to get started you must:

1.      download the tool at http://support.cognos.com/supported/supportlink/techniques/ta_0612_03.zip.  

2.      modify the file “BuildValidateCognos8.bat” to match your environment for the “JAVA_HOME” and “CRN_HOME” environment variables. (NOTE:  I had to rename the file to .txt in order to update it)

3.      modify the file “RunValidateCognos8.bat” to match your environment’s dispatcher value

4.      execute the “BuildValidateCognos8.bat” and then execute “RunValidateCognos8.bat”

5.      provide your namespace and login credentials

6.      select “Y” to validate all reports that are found in your Cognos content store

7.      review the genereated Reports.txt, validate_log.log, and validate_results.log.

 

I use this approach as a safety measure to validate my reports whenever we are packaging our Cognos deployment package for any migration.

 

In another post I’ll discuss how can we do this Cognos SDK validation by using C#, and applying this logic prior to a form request when called within your Cognos SDK application.

Prompted for login when running Cognos Report Studio report

If a user is attempting to execute a Report Studio report and they are continually prompted for their user credentials, then make sure that the database connections related to the report’s queries have the correct signon.  An example error message associated to this issue is: 

 

Unable to connect to at least one database during a multi-database attach to 1 database(s).

 

You must validate the user signon credentials for this database connection string.  To resolve this issue by validating the UserId and Password, go to:

 

1. Cognos Connection / Tools / Directory / Data Sources.

2. Click the name of the failed database connection.

3. Click the More link, View Signons, Set Properties, Signon tab.

4. Click Edit the Signon.  Enter valid User ID and password information for the database.

Prompted for login when running Cognos Report Studio report

If a user is attempting to execute a Report Studio report and they are continually prompted for their user credentials, then make sure that the database connections related to the report’s queries have the correct signon.  An example error message associated to this issue is: 

 

Unable to connect to at least one database during a multi-database attach to 1 database(s).

 

You must validate the user signon credentials for this database connection string.  To resolve this issue by validating the UserId and Password, go to:

 

1. Cognos Connection / Tools / Directory / Data Sources.

2. Click the name of the failed database connection.

3. Click the More link, View Signons, Set Properties, Signon tab.

4. Click Edit the Signon.  Enter valid User ID and password information for the database.

Cognos Parameterized Url Example

Here is an example of using a parameterized url to launch a Cognos Report Studio report that contains prompts.  The url contains a reference to the reporting server, the specific report and provides values for the parameters.  The Cognos SDK Developer Guide contains additional documentation with other examples for launching Query Studio and Analysis Studio.

 

 

http://<servername>:<portnumber>/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/report-viewer.xts&method=execute&m_obj=/content/package[@name='GO Sales and Retailers']/report[@name='Prod_Name_Drill_Target']
&p_ProdLine="+ParamValue("Product Line")+"&p_ProdType="+ParamValue("Product Type")+"&p_ProdName="+ParamValue("Product Name")

Cognos Parameterized Url Example

Here is an example of using a parameterized url to launch a Cognos Report Studio report that contains prompts.  The url contains a reference to the reporting server, the specific report and provides values for the parameters.  The Cognos SDK Developer Guide contains additional documentation with other examples for launching Query Studio and Analysis Studio.

 

 

http://<servername>:<portnumber>/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/report-viewer.xts&method=execute&m_obj=/content/package[@name='GO Sales and Retailers']/report[@name='Prod_Name_Drill_Target']
&p_ProdLine="+ParamValue("Product Line")+"&p_ProdType="+ParamValue("Product Type")+"&p_ProdName="+ParamValue("Product Name")

Cognos SDK -- operation time out when using .NET Framework 2.0 and C#

If you are updating your .NET Framework to 2.0 and using Visual Studio .NET 2005 then it is important to perform proper regression testing on your Cognos SDK application and its C# (c-sharp) code.

 

The default timeout for httpwebrequests in Visual Studio .NET 2005 is 100 seconds.  If a single Cognos SDK request from C# (c-sharp) takes longer than 100 seconds then you will receive the following error:

 

            "The operation has timed out

 

            Stack trace:

                        at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequestrequest)

                        at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)

                        at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

 

            ..."

 

 

The fix for this issue is to modify the default request timeout by setting the Timeout property of the Cognos 8 service that is being used.

 

Your sample Cognos SDK C# (c-sharp) code should be set as follows:

 

            reportService1 rptService = new reportService1();

 

            rptService.Timeout = 500000; //timeout in milliseconds

 

        // rptService.Timeout = Timeout.Infinite;  --> note:  this is not recommended for a PRODUCTION environment

Cognos SDK -- operation time out when using .NET Framework 2.0 and C#

If you are updating your .NET Framework to 2.0 and using Visual Studio .NET 2005 then it is important to perform proper regression testing on your Cognos SDK application and its C# (c-sharp) code.

 

The default timeout for httpwebrequests in Visual Studio .NET 2005 is 100 seconds.  If a single Cognos SDK request from C# (c-sharp) takes longer than 100 seconds then you will receive the following error:

 

            "The operation has timed out

 

            Stack trace:

                        at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequestrequest)

                        at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)

                        at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

 

            ..."

 

 

The fix for this issue is to modify the default request timeout by setting the Timeout property of the Cognos 8 service that is being used.

 

Your sample Cognos SDK C# (c-sharp) code should be set as follows:

 

            reportService1 rptService = new reportService1();

 

            rptService.Timeout = 500000; //timeout in milliseconds

 

        // rptService.Timeout = Timeout.Infinite;  --> note:  this is not recommended for a PRODUCTION environment

Add your corporate logo to Cognos Connection

You can customize the Cognos Connection interface for Cognos 8 to resemble your corporate branding.  In order to do this you must modify the system.xml file and place your logo within your Cognos install path location.

 

  1. Start off by placing the image in …Cognos 8 install path/c8\webcontent\skins\companyXYZ\branding\
  2. Back up the system.xml file!  Open the file using Notepad or an XML editor.
  3. Find the element tag “<!—Custom OEM headers -->”.
  4. Uncomment the xml element tag and then add the following section:

<!-- Custom OEM headers -->

<param name="OEM">

<!--Specify custom Cognos Connection / Cognos Viewer left side header here in the form of XHTML snippets.

          -->

<customHeader showContext="false" contextDelimiter="">

<style styleFolderName="companyXYZstyle">

<table style="background-color:#2d5d3d">

<tr>

<td><img src="../skins/companyXYZstyle/branding/XYZLogo.gif"/></td>

</tr>

</table>

</style>

<style styleFolderName="corporate">

<table style="background-color:#ffffff">

<tr>

<td><img src="../skins/corporate/branding/XYZLogo.gif"/></td>

<td class="headerTitle" style="padding-right:2px;whitespace:nowrap"> Company XYZ </td>

</tr>

</table>

</style>

<style styleFolderName="classic">

<table style="background-color:#cccccc">

<tr>

<td><img src="../skins/classic/branding/XYZLogo.gif"/></td>

<td class="headerTitle" style="padding-right:2px;whitespace:nowrap"> Company XYZ </td>

</tr>

</table>

</style>

</customHeader>

</param>

 

5. Restart the Cognos 8 service for these changes to take affect.

 

Add your corporate logo to Cognos Connection

You can customize the Cognos Connection interface for Cognos 8 to resemble your corporate branding.  In order to do this you must modify the system.xml file and place your logo within your Cognos install path location.

 

  1. Start off by placing the image in …Cognos 8 install path/c8\webcontent\skins\companyXYZ\branding\
  2. Back up the system.xml file!  Open the file using Notepad or an XML editor.
  3. Find the element tag “<!—Custom OEM headers -->”.
  4. Uncomment the xml element tag and then add the following section:

<!-- Custom OEM headers -->

<param name="OEM">

<!--Specify custom Cognos Connection / Cognos Viewer left side header here in the form of XHTML snippets.

          -->

<customHeader showContext="false" contextDelimiter="">

<style styleFolderName="companyXYZstyle">

<table style="background-color:#2d5d3d">

<tr>

<td><img src="../skins/companyXYZstyle/branding/XYZLogo.gif"/></td>

</tr>

</table>

</style>

<style styleFolderName="corporate">

<table style="background-color:#ffffff">

<tr>

<td><img src="../skins/corporate/branding/XYZLogo.gif"/></td>

<td class="headerTitle" style="padding-right:2px;whitespace:nowrap"> Company XYZ </td>

</tr>

</table>

</style>

<style styleFolderName="classic">

<table style="background-color:#cccccc">

<tr>

<td><img src="../skins/classic/branding/XYZLogo.gif"/></td>

<td class="headerTitle" style="padding-right:2px;whitespace:nowrap"> Company XYZ </td>

</tr>

</table>

</style>

</customHeader>

</param>

 

5. Restart the Cognos 8 service for these changes to take affect.

 

Cognos 8.2 upgrade -- cognos service does not start

After upgrading to Cognos 8.2 I had an issue with my Cognos service not starting.  The solution was to open Cognos Configuration and to rename the Cognos service.

 

Cognos Configuration / Environment / select the Cognos 8 service / right-click and rename / Cognos service restart.

 

Some people may also have come across this issue when dealing with the Cognos error message CFG-ERR-0106.

Cognos 8.2 upgrade -- cognos service does not start

After upgrading to Cognos 8.2 I had an issue with my Cognos service not starting.  The solution was to open Cognos Configuration and to rename the Cognos service.

 

Cognos Configuration / Environment / select the Cognos 8 service / right-click and rename / Cognos service restart.

 

Some people may also have come across this issue when dealing with the Cognos error message CFG-ERR-0106.

Auditing your Cognos user activity

When managing a PRODUCTION environment you may be required to log or audit user activity.  Cognos 8 comes with a sample model and series of reports that can you help you achieve this goal.  Ironically enough, the Framework Manager package is called Audit and can be found at …c8_location/webcontent/samples/Models/Audit/Audit.cpf.

 

This sample Framework Manager package will give you a glimpse of some of the items that you can capture during a user session.  Accompanying the Audit model is an Audit deployment package which has 10-12 reports.  Some examples of the reports are:

 

  1. Execute reports by user -- Lists the reports that were run, by user and by package. It also includes the timestamp and execution time (in milliseconds) for each report.  You can select a date and time range, one or more users, one or more packages, and one or more reports.
  2. Execution history by user -- Lists the reports that were run alphabetically, along with the package and timestamp, by user, since the logging

database was created.  It includes the total number of times each user ran each report and the total number of reports each user ran

altogether. It also includes the total number of reports run by all users.  You can select one or more users for the report. After you run the audit report, you can choose to view the statistics for a particular report or for all reports.

  1. Logon operations by time stamp -- Shows logon and logoff timestamps and operations, by user.  It also includes the total number of logons for each user and the total number of logons altogether.  You can select the time period and one or more users for the report.
  2. Logon operations by user name -- Shows logon and logoff timestamp by user, along with the type of logoff operation that occurred.  It also includes the total number of logons for each user and the total number of logons altogether.  You can select one or more users for the report.

 

You can also refer to Chapter 16 of the Administration and Security Guide  for more details on how to implement and modify the Audit package and the Audit reports.

Auditing your Cognos user activity

When managing a PRODUCTION environment you may be required to log or audit user activity.  Cognos 8 comes with a sample model and series of reports that can you help you achieve this goal.  Ironically enough, the Framework Manager package is called Audit and can be found at …c8_location/webcontent/samples/Models/Audit/Audit.cpf.

 

This sample Framework Manager package will give you a glimpse of some of the items that you can capture during a user session.  Accompanying the Audit model is an Audit deployment package which has 10-12 reports.  Some examples of the reports are:

 

  1. Execute reports by user -- Lists the reports that were run, by user and by package. It also includes the timestamp and execution time (in milliseconds) for each report.  You can select a date and time range, one or more users, one or more packages, and one or more reports.
  2. Execution history by user -- Lists the reports that were run alphabetically, along with the package and timestamp, by user, since the logging

database was created.  It includes the total number of times each user ran each report and the total number of reports each user ran

altogether. It also includes the total number of reports run by all users.  You can select one or more users for the report. After you run the audit report, you can choose to view the statistics for a particular report or for all reports.

  1. Logon operations by time stamp -- Shows logon and logoff timestamps and operations, by user.  It also includes the total number of logons for each user and the total number of logons altogether.  You can select the time period and one or more users for the report.
  2. Logon operations by user name -- Shows logon and logoff timestamp by user, along with the type of logoff operation that occurred.  It also includes the total number of logons for each user and the total number of logons altogether.  You can select one or more users for the report.

 

You can also refer to Chapter 16 of the Administration and Security Guide  for more details on how to implement and modify the Audit package and the Audit reports.

Cognos SDK -- customized exception handler

We all make mistakes and when comes to programming I’m sure that I’ve made enough to fill an infinite loop array.  Here is some sample code to help you create a customized Exception Handler class.  Once again the Cognos SDK code is in C# for all of us .NET users.

 

using System;

using System.Web.Services.Protocols;

using System.Xml;

using System.Text;

using cognosdotnet;

 

namespace CognosSDK

{

       /// <summary>

       /// Handles SOAP exceptions.

       /// </summary>

       public class SoapExceptionHandler

       {            

              private SoapException exSoap = null;

 

              public SoapExceptionHandler(SoapException ex)

              {

                     exSoap = ex;

              }

 

              public string Message

              {

                     get

                     {

                           return exSoap.Message;

                     }

              }

              /// <summary> /// Return the exception severity. /// </summary>

              public string Severity

              {

                     get

                     {

                           XmlNode severityNode = exSoap.Detail.SelectSingleNode( "//severity");

                           if (severityNode != null)

                           {

                                  return severityNode.InnerText;

                           }

                           return "";

                     }

              }

              /// <summary> /// Return the exception errorCode. /// </summary>

              public string ErrorCode

              {

                     get

                     {

                           XmlNode errorNode = exSoap.Detail.SelectSingleNode( "//errorCode" );

                           if (errorNode != null)

                           {

                                  return errorNode.InnerText;

                           }

                           return "";

                     }

              }

              /// <summary> /// Return the exception messageStrings. /// </summary>

              public string[] Details

              {

                     get

                     {

                           XmlNodeList nodes = exSoap.Detail.SelectNodes( "//messageString" );

                           string[] retval = new string[nodes.Count];

                           for( int idx = 0; idx < nodes.Count; idx++ )

                           {

                                  retval[idx] = nodes[idx].InnerText;

                           }

                           return retval;

                     }

              }

              /// <summary> /// Convert this Cognos8Exception into a string for printing. </summary>

              /// <returns>A string representation of the Cognos8Exception.</returns>

              public override string ToString()

              {

                     StringBuilder str = new StringBuilder();

                     str.AppendFormat( "Message: {0}\n", Message );

                     str.AppendFormat( "Severity: {0}\n", Severity );

                     str.AppendFormat( "ErrorCode: {0}\n", ErrorCode );

                     str.AppendFormat( "Details:\n" );

                     foreach( string s in Details )

                     {

                           str.AppendFormat( "\t{0}\n", s );

                     }

                    

                     return str.ToString();

       }

       /// <summary> Convert a SoapException into a Cognos8Exception string. This is the same as creating a              Cognos8Exception and calling its ToString() method.

       /// </summary>

       /// <param name="ex">The SoapException to format.</param>

       /// <returns>A string representation of the exception.</returns>

      

       static public string ConvertToString(SoapException ex)

       {

              SoapExceptionHandler exception = new SoapExceptionHandler(ex);

              return exception.ToString();

       }

       }

 

 

       /// <summary>

       /// Handles BiBus Exceptions

       /// </summary>

       public class BiBusHeaderException

       {

              private CAMException exBiBus = null;

              /// <summary>

              /// Create a BiBusHeaderException object.

              /// </summary>

              /// <param name="crn">The Service object in use during the last exception.</param>

              public BiBusHeaderException( contentManagerService1 cmService )

              {

                     // Pull the CAM exception out of the biBusHeader.

                     exBiBus = cmService.biBusHeaderValue.CAM.exception;

              }

              /// <summary>

              /// Get the Severity string from this BiBusHeaderException.

              /// </summary>

              public string Severity

              {

                     get

                     {

                           return exBiBus.severity.ToString();

                     }

              }

              /// <summary>

              /// Get the errorCode string from this BiBusHeaderException.

              /// </summary>

              public string ErrorCode

              {

                     get

                     {

                           return exBiBus.errorCodeString;

                     }

              }

              /// <summary>

              /// Get the details (messageString) from this BiBusHeaderException.

 

              /// </summary>

              public string[] Details

              {

                     get

                     {

                           string[] retval = new string[exBiBus.messages.Length];

                           for( int idx = 0; idx < exBiBus.messages.Length; idx++ )

                           {

                                  retval[idx] = exBiBus.messages[idx].messageString;

                           }

                           return retval;

                     }

              }

              /// <summary>

              /// Get the promptInfo (and useful captions/displayObjects inside) to

              /// facilitate prompting the user, if this is a recoverable exception.

              /// </summary>

              public promptInfo PromptInfo

              {

                     get

                     {

                           return exBiBus.promptInfo;

                     }

              }

              /// <summary>

              /// Convert this BiBusHeaderException into a string for printing.

              /// </summary>

              /// <returns>A string representation of the BiBusHeaderException.</returns>

              public override string ToString()

              {

                     StringBuilder str = new StringBuilder();

                     str.AppendFormat( "Severity: {0}\n", Severity );

                     str.AppendFormat( "ErrorCode: {0}\n", ErrorCode );

                     str.AppendFormat( "Details:\n" );

                     foreach( string s in Details )

                     {

                           str.AppendFormat( "\t{0}\n", s );

                     }

                     return str.ToString();

              }

              /// <summary>

              /// Convert a BiBus Header exception into a BiBusHeaderException string.

              /// This is the same as creating a BiBusHeaderException and calling

              /// its ToString() method.

              /// </summary>

              /// <param name="ex">The Service object that threw the exception.</param>

              /// <returns>A string representation of the biBusHeader exception.</returns>

              static public string ConvertToString( contentManagerService1 cmService )

              {

                     BiBusHeaderException exception = new BiBusHeaderException( cmService );

                     return exception.ToString();

              }

       }

}