cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

How to find out which report recipe is used by report

mrump
14-Alexandrite

How to find out which report recipe is used by report

Hi all,

 

I'm currently stuck in a cleanup and refactoring task for our server setup.

I want to remove a number of duplicate or outdated report-recipes and I do not want to "harm" my users more than necessary.

 

So I need to find out which ( "user specifc" and admin) report instance is using which report-recipe file.

 

The

 

"im reports"

 

and

 

"im viewreport"

 

commands are currently of no help, as the desired infromation is not available as a field (or at least I didn't find it )

 

Any idea is welcome

 

Thanx in advance

Matthias

1 ACCEPTED SOLUTION

Accepted Solutions
MichaelChatel
20-Turquoise
(To:mrump)

Hey Matt,

Give "im reports --fields=recipeParams" a try.

I was also wondering how to get this info, when I saw your inquiry, so was consulting with one of my colleagues here (Alan), and it looks like that will give you some type of info about the recipes at least.

ex.

im reports --fields=id,name,recipeParams --fieldsDelim="|" "All Incidents"

Gives the result:

9732|All Incidents|Dynamic:true;ReportType:Basic - HTML, Column;/root/FieldsCollection:Current Item ID@weblink,Summary,Assigned User,ZZZ_Support Rep__Do not Reuse,R&D Rep;/root/PrinterStyleType:Color Scheme 2;/root/ReportLogo:incident.png;/root/ScreenStyleType:Color Scheme 2.css;/root/SortInfoMap:Assigned User@ascending;/root/reporttitle/ParamValue:All Incidents

You can see the "ReportType" value in there.

It's not the best presentation of the info you're looking for, but it's what we have.

View solution in original post

2 REPLIES 2
MichaelChatel
20-Turquoise
(To:mrump)

Hey Matt,

Give "im reports --fields=recipeParams" a try.

I was also wondering how to get this info, when I saw your inquiry, so was consulting with one of my colleagues here (Alan), and it looks like that will give you some type of info about the recipes at least.

ex.

im reports --fields=id,name,recipeParams --fieldsDelim="|" "All Incidents"

Gives the result:

9732|All Incidents|Dynamic:true;ReportType:Basic - HTML, Column;/root/FieldsCollection:Current Item ID@weblink,Summary,Assigned User,ZZZ_Support Rep__Do not Reuse,R&D Rep;/root/PrinterStyleType:Color Scheme 2;/root/ReportLogo:incident.png;/root/ScreenStyleType:Color Scheme 2.css;/root/SortInfoMap:Assigned User@ascending;/root/reporttitle/ParamValue:All Incidents

You can see the "ReportType" value in there.

It's not the best presentation of the info you're looking for, but it's what we have.

mrump
14-Alexandrite
(To:mrump)

Hi Michael,

thank you for the reply.

I already came up with a solution myself, using the same approach.

I wrote a Powershell skript taht reads up all "recipeParams" for all reports and counts the appearance of each recipe.

The finall result is stored in a csv file.

Unfortunately I cannot the script as a file , so here's the CODE

[String]$IMCmd =$env:Integrity+"\bin\im.exe";

[String]$ApiViewerCmd =$env:Integrity+"\bin\mksAPIViewer.exe";

[String]$AACmd = $env:Integrity+"\bin\aa.exe";

[String]$SICmd = $env:Integrity+"\bin\si.exe";

$AArgHost = "--hostname=<myServer>"

$AArgPort = "--port=7001"

$AArgLocal = "--iplocal"

$AArgXml = "--xml"

$AArg_params = "--fields=id,recipeParams"

$CSVoutFile = "c:\temp\export.csv"

cls

&$IMCmd "diag" $AArgHost $AArgPort "--diag=viewallobjectsforsession" "on"

Write-Host "enabled visibility for all objects"

# get list of all reports

$reports = &$IMCmd "reports" $AArgHost $AArgPort

# use a dictionary to store the findings

$dict = New-Object 'system.collections.generic.dictionary[string,int]'

Write-Host "found " $reports.Count "reports , starting analysis"

foreach($report in $reports ){

  # get the reports details per report (a specific report name must be used)

  [string]$reportinfo = &$ApiViewerCmd $AArgLocal $AArgXml "im" "reports" $AArgHost $AArgPort $AArg_params "$report"

  # workaround for Powershell's inability to handle xml-version 1.1

  $newXml = $reportinfo.replace('xml version="1.1"','xml version="1.0"')

  # convert to XML document

  [xml]$xml = [xml]$newXml

  #use xpath to find the used recipe in the xml file

  Select-Xml -XPath '//Field[@name="ReportType"]/Value' $xml|

  foreach{

  $count = 1;

  if ($dict.ContainsKey($_)){

  $count = [int]$dict.get_Item($_) + 1;

  $dict.set_Item($_,$count)

  }

  else{

  $dict.Add($_,$count)

  }

  Write-Host $_ " --> " $count

  }

}

#exprt dict as csv file

$dict.GetEnumerator() | sort-object Key | export-csv $CSVoutFile

Write-Host "done - CSV exported"

&$IMCmd "diag" $AArgHost $AArgPort "--diag=viewallobjectsforsession" "off"

Write-Host "disabled visibility for all objects"

Top Tags