Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I import a tab-separated CSV using Workitem-command-Line?

WCL 5.3.1
Plain-Javalib 6.0.6
JDK OpenJDK1.8.0
console:Windows CMD.exe(locale:japanese)

How can I import a CSV , delimiter use TAB?

"Delimiter Options do not set
No attributes or columns found for row 2. Check the import file format or delimiter. Delimiter is ';'
com.ibm.js.team.workitem.commandline.framework.WorkItemCommandLineException: Work item type not specified.

set option delimiter="\t"

Can not convert delimiter. Delimiter must have size 1 >\t<

0 votes

Comments

 How did you call WCL? Did you try the -delimiter parameter?

You might want to consider converting the tab separated value file into a comma separated value file and use that instead.

I'm sorry for the late reply.

set delimiter's option
delimiter="\t"
CSV:
UTF-16le Divided character tab

command line
-importworkitems repository="https://rtc_ServerURL" user="user" password="password" projectArea="testproject" importFile="sample.csv" /importdebug encoding="UTF-16LE" delimiter="\t"


Accepted answer

Permanent link

 I do not know why apparently my answers are ignored. WCL DID NOT SUPPORT the TAB Character, regardless which OpenCSV version was used. The reason, the tab character is entered as a character that is longer than one character. That was prevented. I have added this capability in the newest code, but there is no release yet with the change. You would have to create your own release.  

Ralph Schoon selected this answer as the correct answer

0 votes

Comments

 I'm sorry, I didn't intend to ignore it.

I understand that it is not supported.
I am trying to change "corresponding to \t".


2 other answers

Permanent link

The answer is: I do not know how you could specify a tab as the character <tab> passing "\t" does not work, because it has more than one character. It would be necessary to enhance the tool to be able to provide a way to specify tab as a string input. The source is available on Github, if you have the time, I would be happy about suggestions or a pull request..  

0 votes

Comments

This is the code that would need to change. It basically converts the char from the string and can not handle quote characters. This would need to change.  

    /*
     * setter for the quote character
     * 
     * @return
     /
    private void setDelimiter(String delimiter) {
        if (delimiter.length() != 1) {
            throw new WorkItemCommandLineException("Can not convert delimiter. Delimiter must have size 1 >"
                    + delimiter + "<");
        }
        fDelimiter = delimiter.charAt(0);
    }

This is not an easy feat and I found that a lot of claims how to do this e.g. on stackoverflow did not work.


 
The code below should work but I have no time to test it.:


The problem is, that the escaped character in the command line is converted to a string with two backslashes and a t like "//t" (replace the slash with a backslash, the forum does not display both backslashes....).

 I did the required changes and delivered to the master. However, I do not have the time to test (I only tested export which works) and I can not create a release.

thank you!
I will refer to the change idea.
It seems that some people respond without changing the program, so I will ask a question.
I will download sourcecode from master blanch

The code of WCL never supported \t as delimiter correctly. So a code change was needed. 


Permanent link

I was confirmed.
It seems that "\t" was effective because OpenCSV was used in WCL4.0.
Consider changing the source code.

I think that comma "," is not used if possible because of risk.
Because there is a possibility of using a double coatation in the column.

0 votes

Comments

CSV files with values that contain commas should be safe. The correct encoding is to enclose the value in double quotes, with any quotes in the value being escaped. There are standard Java libraries, such as OpenCSV, that take care of issues like this.

No, your version of WCL has a specific rule implemented that prevents to enter tab as "\t" regardless what library is used later. The way how "\t" is passed in the command line makes special handling necessary, which required code changes. I have detailed this in my various comments. I would suggest to use the , or ; as delimiter and use the quote characters '"' around the column values as David suggested.  

I have added special treatment that allows to pass "\t" to WCL.

 Thanks!!

Even if the values enclosed in the double coatings contain a comma, if it is correctly recognized, a CSV using a comma may be fine.
example
id,summary,priority,owner
1234,"test id a,b,c or d",high,leader_bob

WCL ver4.0.0
At the time of this version, OpenCSV 3.7 was used,
It seems that `t can be used for Delimiter, only when running WCL with PowerShell.

*OpenCSV 4.3 not running `t.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,936

Question asked: Sep 16 '22, 4:51 a.m.

Question was seen: 1,255 times

Last updated: Sep 26 '22, 4:24 a.m.

Confirmation Cancel Confirm