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

How can I get the Report Package Name?

Started by jdzurek, 06 Oct 2011 03:31:52 PM

Previous topic - Next topic

jdzurek

Is there a way to get the package being used for a given report WITHOUT parsing through the report XML Spec?

thanks!

bdbits

It's listed near the bottom on the general properties for the report.

jdzurek


jdzurek

So this is kind of a round about way that has worked for me... i still feel like there should be a property or maybe there is and im missing it to get the package used in a given report.... this is the work around I came up with that seems to be working....(fingers crossed lol)....



        String sReportSpec = null;
        PropEnum props[] = new PropEnum[]{PropEnum.searchPath, PropEnum.defaultName, PropEnum.specification};
        SearchPathMultipleObject spMulti = new SearchPathMultipleObject();
        spMulti.set_value(this.getReportPath());

           BaseClass[] repPth = cognosConnection.getCmService().query(spMulti, props, new Sort[]{}, new QueryOptions());

            // There should be only one report with the specified searchPath
            if (repPth != null && repPth.length > 0) {
                // extract the report spec
                sReportSpec = (((Report) repPth[0]).getSpecification().getValue());
                DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = builderFactory.newDocumentBuilder();
                InputStream is = new ByteArrayInputStream(sReportSpec.getBytes("UTF-8"));
                this.xmlDoc = builder.parse(is);
            }


           if (this.xmlDoc != null) {
                XPath xpath3 = XPathFactory.newInstance().newXPath();
                String xpathExpression_Item = "/report/modelPath";
                XPathExpression expr3 = xpath3.compile(xpathExpression_Item);
                NodeList modelPathList = (NodeList) expr3.evaluate(xmlDoc, XPathConstants.NODESET);
                String innerText = modelPathList.item(0).getTextContent();
                String sub1 = innerText.substring(innerText.lastIndexOf("/package[@name='") + 16);
                int endIndex = sub1.indexOf("']");
                this.ContainingPackage = sub1.substring(0,endIndex);
            }



AussiePete2011


murali999

Hi,

You can get the package name By using

(AuthoredReport)bc[0].getMetaDataModelPackage().getValue();


Grim

"Honorary Master of IBM Links"- MFGF
Certified IBM C8 & C10 Admin, Gamer, Geek and all around nice guy.
<-Applaud if my rant helped! 8)