Cognos SDK Guide by BI Centre can be purchased from PayPal.

You will have your own functional Cognos 8 SDK web solution that has been tailored to be scalable and flexible in order to adapt to your unique business requirements and solution architecture.


Thursday, January 17, 2008

Show All Packages in Default.aspx -- CognosSDK.cs

Show all packages

 

The entry point to our Cognos SDK web solution will be Default.aspx.  This will be a basic web page that will only contain a listbox control and a command button.  The listbox will be populated with all of the package items that exist in the specified Cognos Content Store.

 

Default.aspx will call the CognosSDK.cs object in order to query the Cognos Content Store for a list of Content Store objects.  In this case, we will only be interested in retrieving the list of all Content Store package objects that are of the type packageConfiguration.

 

The Default.aspx.cs PageLoad() event will contain the following C# code.

 

if (!Page.IsPostBack)

                  {

                       

                        baseClass[] _bc =  _cogSDK.getObjects(_cmService, _CSTypePkg, null);

                 

                        if (_bc != null)

                        {

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

                              {

                                    if ( _bc[i] is packageConfiguration)

                                    {                            

                                          lstPackages.Items.Add(_bc[i].defaultName.value.ToString());                        

                                    }

                              }    

                        }

                  }

 

 

 

This will require the CognosSDK.cs object to be instantiated in order to access the getObjects() method.

 

public baseClass[] getObjects(contentManagerService1 _cmService, string _path, string _package)