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

exporting result from CLI command into XML

Newbie

exporting result from CLI command into XML

Good Morning,

I apologize if it is a dumb question as I very new to this .

We have a requirements in which I have to collect data via PTC integrity tool. I am thinking of creating batch file but before I want to run command manually to make sure I am getting desire results.

I get the results by running

im issues --query='query name' <== That will give me result in the CLI window

I am just wondering if I can get the result(s) in XML. and then run the next command which is

im viewissue <id>

and get the result in xml file.

Hope I explained it properly

10 REPLIES 10

Re: exporting result from CLI command into XML

Hi

You could use the --xmlapi flag and redirect output to a file.

--xmlapi won't be supported anymore in the future.

Using Java API instead of CLI is recommended.

Kind regards.

Thierry

Re: exporting result from CLI command into XML

ok Thank you. it worked. In order to process the xml file to get the ID so I can run the Viewstate command. what is the right command to use.

attached is output I just need the value of ID field.

<?

<<Fie

for future use I don't even know where to look for Java API. can you help as well?

Thank you for your help

Re: exporting result from CLI command into XML

Hi,

Thierry's answer is correct but its not supported for the future.

For better understanding tell us in which format you need to collect the data.

you can export to excel with:

im exportissues --query=<queryname>

(you can define the exported fields with the option --fields=field,field,....)

For more options yu have to use the java api.

Look at your server webpage or at PTC support website under Reference Documents.

Your code need something like this:

// only example not really runnable:

c = new Command();

c.setApp(Command.IM);

c.setCommandName("exportissues");

c.addOption(new Option("Y"));

c.addOption(new Option("querydefinition", "QUERYNAME"));

c.addOption(new Option("exportHeadings"));

c.addOption(new Option("sortField", "Label"));

c.addOption(new Option("fields", "Label,ID,Summary,State,External"));

// ProcessBuilder needed because of

// "not supported from IntegrityAPI"


pb = new ProcessBuilder(c.toStringArray());

p = pb.start();

p.waitFor();


Re: exporting result from CLI command into XML

Thank you for the response. I want the data in XML if it is possible and as easy as importing it to excel as you mentioned above. Is there any easy way to get it into XML?

Re: exporting result from CLI command into XML

only from java api or very simple is to use reports for this.

it works perfect from the gui but also from CLI:

you should prefer that solution:

Create the report by using GUI and after that you can easily run the report from CLI:

im runreport "reportname" > name.xml

Re: exporting result from CLI command into XML

Thank you. As I am very new to this apologize for this stupid question. How do I create the report?

Re: exporting result from CLI command into XML

In "Integrity User Viewset" click on Report - Create Report

then choose a name, the query and select as type "Basic - XML"

Re: exporting result from CLI command into XML

Thank you Tobias,

But here lies the problem, I cant use the GUI as everything I am trying to achieve is done through because I want different project to connect to MKS and get the result set. So is there a command that I can run under the command window to achieve the results?

Re: exporting result from CLI command into XML

first you have to create an report, its an design-element where you describe in which content in which format you want to export.

You can do that from CLI (syntax is not very easy, here you have to look in CLI Reference Guide for im createreport), but better is to do that from GUI.

You only have to do this once!!!

then you can run the report (to get the content) from CLI by using:

im runreport "reportname"