Hi,
I am trying to get a list of all reports linked to a given package.
In our Cognos 8.2 implementation the reports are organised into departmental folders, and are
not stored within the associated package folders.
I am new to the SDK, and have experimented with the VB6 code below. The basic steps are:
1. Query the Content Store for a list of all reports
2. For those reports which are linked to the given package, record and display the name
The code works, however it actually returns no report names because our reports are not stored within the package folders. The SDK documentation states the following of the packageBase property:
If the object is not a descendant of a package, the value of this property is the path to the root
object.
Thus the problem is that the basePackage property value actually returns the root path i.e. "/", and never the package name.
I guess I need to use another approach for this task, so am grateful for any assistance.
Cheers.
Private Sub List_Reports()
Dim oCM As ContentManagerService
Dim sUserID As String
Dim sPassword As String
Dim sNamespace As String
Dim sPath As New SearchPathMultipleObject
Dim oSortOptions As New SortC
Dim oQueryOpts As New QueryOptions
Dim oProps As New PropEnumC
Dim oReports As BaseClassC
Dim i As Integer
Dim sReports As String
On Error GoTo Exception:
' connection credentials sUserID = "username"
sPassword = "password"
sNamespace = "namespace"
' connect to Content Manager Set oCM = New ContentManagerService
oCM.endPointUrl = "
http://localhost:9300/p2pd/servlet/dispatch"
Call oCM.logon(XMLEncode("<credential><namespace>" & sNamespace & _
"</namespace><username>" & sUserID & _
"</username><password>" & sPassword & _
"</password></credential>"), Nothing)
' define query search path parameters sPath.Value = "//report"
oProps.Add defaultName
oProps.Add packageBase
' query Content Manager Set oReports = oCM.Query(sPath, oProps, oSortOptions, oQueryOpts)
' iterate through reports For i = 1 To oReports.Count
' look for package If oReports.Item(i).packageBase.Value = "PackageName" Then
' record report name sReports = sReports & oReports.Item(i).defaultName.Value & vbCrLf
End If
Next i
' show reports MsgBox sReports
Exit Sub
Exception:
MsgBox Err.Description
End Sub