It's all about the answers!

Ask a question

How do we stop duplicate categories being created when importing work items from a csv file?


Martin McAuley (1721324) | asked Nov 11 '14, 7:36 a.m.
We are successfully importing work items from a csv file but are seeing duplicate categories created. Specifically the import sometimes has items with a category and sometimes with the same category and a sub-category. This is causing the category to be created twice, once as a category with no sub-categories and again as a category with sub-categories. When writing a query there are then 2 identically named categories to chose from which return different work items i.e. those with just the category and those with the category and a sub-category. This looks like a bug? As a work-around we could create a dummy 'Unassigned' sub-category in the csv file so that all items have both a category and sub-category.

Comments
Ralph Schoon commented Nov 11 '14, 8:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Since there are so many versions out now, it is a good practice to mention the one you are using. I am aware that there was a defect where the recognition of the categories did not work as expected. That caused the issue. Your case might be a different one.


Martin McAuley commented Nov 11 '14, 8:38 a.m.

sorry forgot to say it is 4.0.6


sam detweiler commented Nov 11 '14, 8:46 a.m.

what is the value of the category in the CSV file? 

a path root/cat/subcat
or just
subcat?

I found that changing the output on the export to the path made the import correct..

on the 'choose attributes to export' dialog, click the dropdown and select Internal Value (we needed to do this for iteration and category)



Martin McAuley commented Nov 11 '14, 9:19 a.m.

The import csv contains entries of the form "category" / "sub-category" i.e. no path-root. It does not seem to need the path-root as this format creates the category and sub-category as expected under the path-root. It is just that we end up with separate path-root/category (from imported items that don't have a sub-category) and path-root/category/sub-category (for imported items that do have a sub-category) for the same category. Following your suggestion I can see that the internal-value is a uuid, however that does not help as we are generating the csv from another non-rtc system.


sam detweiler commented Nov 11 '14, 10:08 a.m.

could you show us a sample of the different category strings in the csv file and results.. cause I'm not quite sure I understand..



Martin McAuley commented Nov 11 '14, 10:39 a.m.

I have investigated further and it doesn't occur if the single category import item occurs first, but the problem does occur if a single category import item occurs after a category/sub-category item e.g. with the following csv import file 'Category1' is listed twice on the 'Work Item Categories' tab.

"Type","Filed Against","Summary"
"Task","Category1" / "Sub-Category1","task 4"
"Task","Category1" / "Sub-Category2","task 5"
"Task","Category1","task 6"



Rosa Naranjo commented Nov 12 '14, 4:51 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Sam, Ralph, or Martin, if one of you think that one of the above comment is an answer for this question, please convert your comment to an answer so this question can be marked as answered.


Ralph Schoon commented Nov 13 '14, 3:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

My comment is certainly no answer.

showing 5 of 8 show 3 more comments

Accepted answer


permanent link
Ralph Schoon (60.9k33643) | answered Nov 13 '14, 3:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Given Martins comment
I have investigated further and it doesn't occur if the single category import item occurs first, but the problem does occur if a single category import item occurs after a category/sub-category item e.g. with the following csv import file 'Category1' is listed twice on the 'Work Item Categories' tab.

"Type","Filed Against","Summary"
"Task","Category1" / "Sub-Category1","task 4"
"Task","Category1" / "Sub-Category2","task 5"
"Task","Category1","task 6"
I would suggest to make sure to create the categories or to provide work items in an order that creates the categories. I would also suggest to create a defect, as I would expect the categories to be created correctly.

Martin, if this summarizes the matter, please accept.

Martin McAuley selected this answer as the correct answer

One other answer



permanent link
sam detweiler (12.5k6188201) | answered Nov 11 '14, 11:04 a.m.
thanks.. I 'thought' I read somewhere in the library that the order had to be parent first.  (but I can't find it now)

Category1
before any child of Category 1

On my project copy utility I build the category tree before import, so don't experience this problem.

Your answer


Register or to post your answer.