Purchase your Section 508 Compliance Support guide now!

Purchase your Section 508 Compliance Support guide now!

Cognos 8 SDK -- wait for response

Hello, here is an SDK example of waiting for the Cognos 8 report service response to complete.

 

try
        {
           //get the initial response
           C8response = oCrn.execute(path,pv,ro);
                        
           //if it has not yet completed, keep waiting until it is done
           if(C8response.getStatus() != AsynchStatusEnum.complete)
           {
            int count = 1;
            while (C8response.getStatus() != AsynchStatusEnum.complete && 
C8response.getStatus() != AsynchStatusEnum.responseReady)
            {
                System.out.println("C8response.getStatus() = wait: " + count++);
                C8response = oCrn.wait(C8response.getPrimaryRequest());    
            }
            if(C8response.getStatus() == AsynchStatusEnum.responseReady)
                C8response = oCrn.getOutput(C8response.getPrimaryRequest());
            
            if (C8response != null)
                C8response = oCrn.getOutput(C8response.getPrimaryRequest());
           }
           //return the final C8responseponse
           return C8response;
    
        }
        catch(Exception e)
        {
            return null;    
        }