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



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

Main Menu

Tip: Retrieving a list of reports with their packages

Started by dew, 31 Jan 2011 07:57:10 AM

Previous topic - Next topic


Hi there. 
If you want to get a list of report or report views, with the package they are based on, here is a how-to to get you started.

First query the content store for your target reports you with these PropEnum properties
- PropEnum.defaultName,
- PropEnum.searchPath,
- PropEnum.metadataModelPackage

For each report returned , you want to create another query to get that specific report's package.
Use the getMetadataModelPackage() on each baseclass result
   AuthoredReport theReport = (AuthoredReport)results;            
   BaseClassArrayProp ob = theReport.getMetadataModelPackage();                  
   BaseClass[] bc = ob.getValue();               
   GuidProp gp = bc[0].getStoreID();
   Guid guid = gp.getValue();
   String strStoreID = guid.getValue();
   String strQuery = "storeID('" +strStoreID  +"')"

Now you can use strQuery in a new query to get the Package details.
   .query(new SearchPathMultipleObject(strQuery)

The StoreID uniquely identifies a content store object since cognos 8.3, so can use that directly as a query.
If you need to do this for a specific Report View, then you first need to get the authored-report of that report view, in other words, the actual report that the report view is based on.
Note that it may take a while to query the content store of you have thousands of reports ;)

Hope this helps,


Thank you for your kind effort

I’m trying to follow your example but  an error keep appearing to me

the code doesn't work right so I attached it here

can you please explain to me what I did wrong.

Thanks in advance 8)

String path = request.getParameter( "path" );
if ( path == null ) {
path = "/content/folder[@name='Reports']";

PropEnum propm[] = new PropEnum[]{PropEnum.defaultName,PropEnum.searchPath,PropEnum.metadataModelPackage};

BaseClass bc_obj[] = cognos.query(new SearchPathMultipleObject(path),propm,new Sort[] {},new QueryOptions());
        AuthoredReport oReport = (AuthoredReport)bc_obj[0];
        BaseClassArrayProp ob = oReport.getMetadataModelPackage();
        BaseClass[] bc_object = ob.getValue();
        GuidProp gp = bc_object[0].getStoreID();
        Guid guid = gp.getValue();
        String strStoreID = guid.getValue();
        String strQuery = "storeID('" +strStoreID  +"')";


Hello Aljasmi.

I think it's your SearchPath that might cause the error.  The code I provided will only work on AuthoredReport objects, and your Path will include other objects as well.

Try using:
path = "/content/folder[@name='Reports']//report"
This will select all AuthoredReport objects.
Hope it works 8)