sdkcognoscognos-8cognos-bicognos-10

SDK to extract the contents of the Cognos Web Page


Currently I'm working in Cognos v10.1.2 . Is there any SDK to extract the contents of the Cognos Web Page?

We are developing a monitoring window for the end users where they can view the status of their report instead of mails and calls.

The access of MDC table which stores are reports names and its details is restricted. So, We need to create an SDK for it. Thanks in advance for your valuable help.


Solution

  • You need to review the available methods in the SDK and put together your own calls to pull the jobs and associated status information and wrap it in a web/desktop UI. This would include the login/SSO methods since you want to be able to securely filter to those jobs matching an authenticated user.

    Lucky for us IBM provides sample code! Below is an example of pulling the owner of a schedule, the full code example is at http://www-01.ibm.com/support/docview.wss?uid=swg21645622.

    Here's another good one showing how to pull all scheduled jobs from the content store: http://www-01.ibm.com/support/docview.wss?uid=swg21346334

    Helpful hint: This requires that you login first, but you can avoid the byzantine IBM support site and search for "SDK samples" at this URL for more code examples: https://www-947.ibm.com/support/entry/myportal/product/cognos/cognos_support_(general)?productContext=117510243

    public void getOwner(String sPath) 
    {
        try 
        {           
            PropEnum props[] = new PropEnum[]{ PropEnum.searchPath, PropEnum.owner};
    
            //Query content store to get the schedule of the report
            BaseClass[] bc_sch = cmService.query(new SearchPathMultipleObject(sPath),props,new Sort[]{},new QueryOptions());
            if (bc_sch != null && bc_sch.length >0)
            {   
                //Get searchpath of schedule owner
                for (int i=0; i<bc_sch.length;i++)
                {
                    Schedule schedule = (Schedule)bc_sch[i];                        
                    BaseClass[] bc = schedule.getOwner().getValue();                    
                    Account acct  = (Account) bc[0];
                    String searchPath = acct.getSearchPath().getValue();
    
                    PropEnum[] props_acct = new PropEnum[]{PropEnum.defaultName, PropEnum.userName, PropEnum.givenName, PropEnum.surname};
    
                    // query Account to get account name info
                    BaseClass[] bc_acct = cmService.query(new SearchPathMultipleObject(searchPath),props_acct,new Sort[]{},new QueryOptions());
                    Account owner = (Account) bc_acct[0];
    
                    String name = owner.getDefaultName().getValue();
                    String user = owner.getUserName().getValue();
                    String firstname = owner.getGivenName().getValue();
                    String lastname = owner.getSurname().getValue();
    
                    System.out.println("Owner is");
                    System.out.println("userName: " + user);
                    System.out.println("defaultName: " + name);
                    System.out.println("firstname lastname: " + firstname + " " + lastname);                    
                }
            }
            else
                System.out.println("No schedule is found");
    
        }