Get list of All Reports in Cognos via IBM Cognos Administration

In this post I was wondering if it was possible to get a list of All Reports in Cognos via API:

I’m a bit of a noob with NetApp OnCommand Insight (OCI) and IBM Cognos really (one nice 3-day course 3 years ago, and perhaps a few weeks of development time in between then and now - when I wasn’t busy delivering stuff - and now a couple of months in a real-world environment). Anyway...

Then, I just happened to come across IBM Cognos Administration Console. Which you access via the tick button in the bottom left corner and click ‘Administration console’. This is Cognos 11.1.

Image: Click the tick in the bottom left corner

Image: Then choose ‘Administration console...’ from the menu

The only problem with the data in IBM Cognos Administration, is that I cannot see a way to export the data to a CSV/Spreadsheet. Without having done much investigation, it is looking like copy and paste the data into a text file, then parse it to make it useful, which is a bit of a bummer.

In IBM Cognos Administration there are 4 tabs: Status, Security, Configuration, Library

The pages that are of interest to me - with a view to accomplishing the titular task - are:

Status > Past Activities
You can see every report that has ever been run for all time (pretty much).
- Name of report
- Path to report
- Requested time
- Run by
- Status

Status > Upcoming Activities
This also has a nice chart to show you when activities run, so you can schedule things not to all run at the same time.
- Name of report
- Path to report
- Request time
- Scheduled by
- Priority

Image: IBM Cognos Administration > Status > Upcoming Activities

Status > Schedules
- Name of report
- Path to report
- Modified
- Scheduled by
- Status
- Priority

Not yet made up my mind which of ‘Upcoming Activities’ or ‘Schedules’ is most useful to me.

My initial thought is this.
1) Create a table of all the scheduled reports, then management can verify if these scheduled reports are really needed or not.
2) Go through ‘Past Activities’ and anything that has not be run for a very long time, can probably be hidden/removed.
3) Anything else (stuff that might have never been run, or default reports) can also probably be hidden/removed.

Then, tidy up completed (at least phase 1 of tidy up.)

PowerShell Scripts to Parse Output from Past Activities and Schedules

No way to export a report from IBM Cognos Administration that I could see, but you can display all the items and then click and drag over everything, Ctrl+C, to get that data. Which you copy to a text file then parse to get a tabular (CSV) output.

Note: For both 'Past Activities' and 'Schedules' I am using the 'Show Details' view to get path information (it's a little button towards the top right of the 'IBM Cognos Administration' WebUI.)

Get Schedules

[System.Array]$Scheds = Get-Content "Schedules.txt"
[System.Array]$Scheds2 = @()
$Scheds | Foreach {If($_.Trim() -ne ""){$Scheds2 += $_.Trim()}}

[System.Array]$Output = @()
[Boolean]$Record = $FALSE
[Int]$Count = 1

$Scheds2 | Foreach{
  If($_.StartsWith("Report")){
    $Record = $TRUE
    $Count = 1
  }
  If($Record){
    If($Count -eq 2){[String]$ReportName = $_.Trim()}
    If($Count -eq 3){[String]$ReportDate = $_.Trim()}
    If($Count -eq 4){[String]$ReportUser = $_.Trim()}
    If($Count -eq 5){[String]$ReportStatus = $_.Trim()}
    If($Count -eq 6){[String]$ReportPriority = $_.Trim()}
    If($Count -eq 7){
      [String]$ReportPath = $_.Substring(7,$_.length -7).Split(".")[0]
      $Record = $FALSE
      $Count = 0

      ## Because we have: REPORT + 'Actions For ' + REPORT
      [Int]$Half = ([String]([Float]($ReportName.length/2 -5))).Split(".")[0]

      $Object = New-Object PSObject -Property @{
        'Report Name' = $ReportName.Substring(0,$half).trim()
        'Modified' = $ReportDate
        'Scheduled By' = $ReportUser
        'Status' = $ReportStatus
        'Priority' = $ReportPriority
        'Report Path' = $ReportPath.Trim()
      }
      $Output += $Object
    }
  }
  $Count++
}

$Output | Export-CSV "GetSchedules.CSV" -NoTypeInformation

Get Past Activities

[System.Array]$PA = Get-Content "Past Activities.txt"
[System.Array]$PAv2 = @()
$PA | Foreach {If($_.Trim() -ne ""){$PAv2 += $_.Trim()}}

[System.Array]$Output = @()
[Boolean]$Record = $FALSE
[Int]$Count = 1

$PAv2 | Foreach{
  If($_.StartsWith("Report")){
    $Record = $TRUE
    $Count = 1
  }
  If($Record){
    If($Count -eq 2){[String]$ReportName = $_.Trim()}
    If($Count -eq 3){[String]$ReportDate = $_.Trim()}
    If($Count -eq 4){[String]$ReportUser = $_.Trim()}
    If($Count -eq 5){[String]$ReportStatus = $_.Trim()}
    If($Count -eq 6){
      [String]$ReportPath = $_.Substring(7,$_.length -7).Split(".")[0]
      $Record = $FALSE
      $Count = 0

      ## Because we have: REPORT + 'Actions For ' + REPORT
      [Int]$Half = ([String]([Float]($ReportName.length/2 -5))).Split(".")[0]

      $Object = New-Object PSObject -Property @{
        'Report Name' = $ReportName.Substring(0,$half).trim()
        'Requested Time' = $ReportDate
        'Run By' = $ReportUser
        'Status' = $ReportStatus
        'Report Path' = $ReportPath.Trim()
      }
      $Output += $Object
    }
  }
  $Count++
}

$Output | Export-CSV "GetPastActivities.CSV" -NoTypeInformation

THE END

Comments