If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Switch icon

Started by FirstIN, 13 Apr 2010 04:44:52 PM

Previous topic - Next topic

FirstIN

I want to use the SDK to switch the icon beside a report link.  Basically, if an ETL process fails and the data is not available, I want to switch the HTML icon to a custom one showing that the report is not ready.  Anyone know how to do this?  Thanks!

lindero

Hi,

there should be a property of the report object. You can change for a specific entry the icon shown in Cognos Connection through editing the properties in CC, so there must be an SDK way as well.

Figure out the report object properties.

hope this helps.

cheers

kali

Hi,

I am new in SDK and I am working on the same problem.

To flip the icon, we would have to update the iconURI property for the reports/packages/folder.

I would like to find out how to identify the object in SDK so that we can update the correct iconURI property.

Does anyone have a sample code that they would like to share?

Any help would be appreciated!

Thanks.




birliban

Hi,

following is a function I wrote (in java) to get a particular user out of my content store.
The class "CRNConnect" is found in the "SAMPLES" folder of the SDK.
The "pathOfUser" parameter holds the CAMID of the user.


This method works for ALL objects in the content store. You have to modify the PropEnum props[] according to your needs though.  The CAMID is found at the property information in the web-ui.

/**
* Get information specific to a particular user.
*
* @param connection Connection to IBM Cognos 8
* @param   pathOfUser  Search path to user to query.   
* @return              User Information.
*
*/
public BaseClass[] getMemberInfo(
CRNConnect connection,
String pathOfUser)
{
BaseClass groups[] = new BaseClass[] {};
PropEnum props[] =
new PropEnum[] { PropEnum.searchPath, PropEnum.defaultName };
try
{
groups =
connection.getCMService().query(
new SearchPathMultipleObject(pathOfUser),
props,
new Sort[] {},
new QueryOptions());
}
catch (Exception e)
{
System.out.println(e);
}
return groups;
}

kali

To access/update iconURI, my plan is to use getIconURI() function from UiClass, which extends to BaseClass.

I tried to downcast BaseClass to UiClass, as shown below, because all examples from the cognos installation is using BaseClass to get all the reports.

BaseClass bc[] = this.getPackages(connection);
UiClass ui[] = (UiClass) bc;

Any ideas why this does not work?




kali

Hi Birliban,

Do you have any examples on how to modify PropEnum props[] ?

Thanks!

kali

I got it to work!

                        BaseClass bc[] = this.getPackages(connection);

         if (bc != null)
         {
            for (int i = 0; i < bc.length; i++)
            {
               System.out.println(
                  "  " + bc.getDefaultName().getValue());
               System.out.println(
                  "      " + bc.getSearchPath().getValue() + "\n");

               AnyURIProp ic = new AnyURIProp();

               ic = ((UiClass)(bc)).getIconURI();
               AnyURIProp icnew = new AnyURIProp();
               icnew.setValue("/samples/images/yellow.jpg");
               ((UiClass)(bc)).setIconURI(icnew);

               PropEnum[] updateProps = {PropEnum.iconURI};
               UpdateOptions updateOpts = new UpdateOptions();
               updateOpts.setReturnProperties(updateProps);
               connection.getCMService().update(new BaseClass[] {bc}, updateOpts);
               
               
               
            }
         }

xiska

Hi

Great job.
But - how many reports do you want to change?

A report has a package connection. I would suggest to use this entry to iterate over all reports, queries, analysis of the package and anywhere in the portal.

Have Fun