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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

report templates in cli

jdcc
1-Visitor

report templates in cli

hi all,

do you have a list of all possible values for --reportTemplate in cli? using the viewreport switch shows the reportTemplate is actually the html code, is this correct?

please advise.

thanks,

4 REPLIES 4

Yes, this is the current expected behaviour.

There are two types of reports in Integrity terminology: recipe-based and template-based.

Recipe-based reports are created using a recipe file on the server (/data/reports/recipes) which defines the layout of the report and contains various tags to substitute in parameters from the report wizard and iterate the report query results. When you save the report in the wizard, the recipe file is processed to swap in the values specified in the wizard and create a "semi-compiled" result we call a template. This is usually HTML but could be CSV or any other format, and is what you are seeing in the CLI.

You can create and/or manipulate a report template directly. There is a section in the Server Administration Guide describing the format of report tags.

When you work in the CLI, the only option available is to work with templates directly. If you run 'im viewreport', modify the template, and then put it back with 'im editreport' from the CLI, you end up with a template report, even if you initially created it with the wizard. This means that if you open the report in the GUI, you will no longer have the report wizard but instead a simple text editor with the template "source code".

In a forthcoming release of Integrity we are looking at expanding the capabilities of the CLI report commands to allow creating/editing recipe-based reports. There will be options to view and edit the report that will display/accept the recipe file name and report wizard parameters, instead of working directly with the template.

Hi Marcus,

Could you please elaborate on how to do as quoted below. Basically, I wanted to create a query first then create a report based on the new query I created via the CLI. But the im createreport requires a reportTemplate. I cannot create a template based on the new query that i just created. Please advise on how to do this. Thanks

"When you work in the CLI, the only option available is to work with templates directly. If you run 'im viewreport', modify the template, and then put it back with 'im editreport' from the CLI, you end up with a template report, even if you initially created it with the wizard. This means that if you open the report in the GUI, you will no longer have the report wizard but instead a simple text editor with the template "source code"."

Hi JDCC,

The report engine uses a template to specify the layout of the report. You define whatever you want in this template (typically HTML), and where you want your query results to appear in a placeholder section.

In order to create a report from the CLI, you need to specify a query and the actual template you want to use via the "reportTemplate" OR "reportTemplateFile" options. They are the same thing -- reportTemplate means specifying the 'guts' in the command string, whereas reportTemplateFile means the 'guts' are in the file you specify. I wouldn't expect the reportTemplate option to be used for anything but the absolute most trivial of templates... your template is likely to be too big and awkward to specify on the command line. So I think you misunderstood the reportTemplate option in your first post. There is not a list of possible values, but instead it is expecting the raw input of your desired template.

My suggestion is that you create an instance of the report you want from the GUI, then run the "im viewreport" command against it from the CLI and capture the template output. You can then examine and tweak that template (see the Server Admin Guide for details on the tags) and use it as the basis for your CLI commands.

Your final CLI commands will be something like:

im createreport --name="Report Name" --query="name:My Query" --reportTemplateFile="c:/template.htm" --description=". . .

where the layout of your report is dictated by the contents of "template.htm", in a format similar to the output you saw from viewreport.

Hi Marcus,

you seem like the right person to ask:

Would you mind have a look at this question ---

Thank you

Matthias

Announcements


Top Tags