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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to add multi-line "Work Description" using CLI?

ptc-4816166
1-Visitor

How to add multi-line "Work Description" using CLI?

I try to add multi-line "work description" using command line interface?

Similar to the follwong:

im editissue --field="Work Description"="Hello\nThank"?

It seems to me that \n does not create and line feed.

Also can we add file from content in a file?

Thank you

ACCEPTED SOLUTION

Accepted Solutions

This also works:

im editissue --field='Comments=Adding new lines^

Line1^

Line2' 123456

Note: Double quote (") is replaced with single quote (')

Balu

View solution in original post

15 REPLIES 15
tdalon
12-Amethyst
(To:ptc-4816166)

You have to escape with ^.

Replace \n by ^\n.

HTH

Thank you for the reply.

But it does not work very well.

When I run this command:

im editissue --field="Work Description"="Line1^\n Line2" 6210729

On Integrity web client, it still shows like this:

[izhang, 31-Oct-2012 9:50:36 AM EDT]

Line1\n Line2

Any more suggestion? Thanks in advance.

This is just off the top of my head and hasn't been tested, but have you tried " \r\n "?

Thank you for the reply.

I tried. But it does not work.

im editissue --field="Work Description"="Line1\r\n Line2" 6210729

im editissue --field="Work Description"="Line1^\r^\n Line2" 6210729

Both do not work.

[izhang, 31-Oct-2012 11:21:36 AM EDT]

Line1\r\n Line2

[izhang, 31-Oct-2012 11:21:17 AM EDT]

Line1^\r^\n Line2

Ok, can I get you to try " <br> "?

So, im editissue --field="Work Description"="Line1<br> Line2" 6210729

I know this works with certain triggers.

tdalon
12-Amethyst
(To:ptc-4816166)

I have in some old script to replace \n by ^\n\n. (this was workgin with MKS2009)

I don't remember why I've doubled the \n.

Maybe it still works?

dmirkovic
12-Amethyst
(To:tdalon)

Hello,


I believe Ian was attempting to use a PERL script to call the Integrity CLI command:

The following example code worked in our internal environment:

**** Example, Editing Item 860 - Adding multi values to a regular text field *****

#!/usr/bin/perl

$ID=860;

my $WorkDesc="Line1\nLine2\nLine3";

print "Editing item - Adding multiple lines\n";

my $mks_cmd="im editissue --field='Multival'='$WorkDesc' $ID";

system($mks_cmd);

print "Done\n";

*****************

Regards,

Dragan

If "Work Description" is a rich longtext field, you can use the "im editissue --richContentField=field=value" command. As Jeremy pointed out with <br>, rich content fields are HTML format.

Thank you for all the reply.

"Work Description" is not a rich text filed. Therefore, <br/> does not work.

I talked to PTC Integrity tech support yesterday and this morning. Currently they do not support this. They will create an RFC for this feature.

I have to use Java API for this.

Thanks.

Below script has worked for me:

(set LF=^

)

setlocal EnableDelayedExpansion

im editissue --field="Comments=Adding new lines!LF!Line1!LF!Line2" 123456

Hope this helps.

Balu

This also works:

im editissue --field='Comments=Adding new lines^

Line1^

Line2' 123456

Note: Double quote (") is replaced with single quote (')

Balu

tdalon
12-Amethyst
(To:ptc-4671727)

Thank you, Balu. I've retried with your hint (replacing " with ') and it works now for me with Integrity 10.2

Venkat_Yakali
5-Regular Member
(To:tdalon)

When i tried with same CLI, both the lines updating in single line.

Is there any news about how to forward multiline commands to the cli interface with integrity 12?

After looking a bit deeper into this topic I have found a solution that works for me and might be helpful for others. The workaround is to use powershell rather than the command line interpreter. Powershell can handle multiline arguments naturally. Therefore I copy my entire command in a powershell script file and run it with powershell.exe from the command line. Like that I can also edit long multiline fields in integrity.

Announcements


Top Tags