Data Management Group
Your #1 Source for Cognos Services and Solutions




Trainer/'s Talk

Trainer's Talk

Displaying a list of only successfully scheduled reports using the Cognos ReportNet SDK


Applies to
ReportNet SDK

Synopsis
Do you want to display only reports that have been successfully scheduled in your custom ReportNet application? Cognos ReportNet is your Solution

Solution Short solution:
Pull the defaultOutput property of the report. When there is no defaultOutput property, don’t show the report.

Long solution:

This solution uses ASP.Net and VB.Net to interact with the ReportNet SDK

'First, we access the Cognos ReportNet object we created when we logged on.
Dim oCrn As CognosReportNetService = Session("oCrn")

'Next, we set the properties of the query we are going to run
Dim properties(2) As propEnum
properties(0) = propEnum.defaultName
properties(1) = propEnum.defaultOutputFormat

'Then, the property for sorting the query we are going to run
Dim sortBy() As sort
sortBy(1) = New sort
sortBy(1).order = orderEnum.ascending
sortBy(1).propName = propEnum.defaultName

'Now, we perform the query to bring back the reports in the Corporate Metrics folder
Dim results As baseClass()
results = oCrn.query("/content/folder[@name='Corporate Metrics'", properties, sortBy, New queryOptions)

'Loop through the results:
Dim rLen As Integer = UBound(results)
For i = 0 To rLen
   Dim curRes = results(i)
   'Get the default output of the report
   Dim outputFormat As String = CurRes.defaultOutputFormat.value.Length.ToString
   'If an error is thrown, then there is no default output and therefore no successfully scheduled report, so we clear the error for the next loop. If there is no error, display the name of the report.
   If Err.Number <> 0 Then
      Err.Clear()
   Else
      Response.Write (curRes.defaultName.value & "
")
   End If
'End the loop
Next

Questions
Have a question for our trainers?
Click here to send your questions!

Copyright 2004 Data Management Group. All Rights Reserved.