AnsweredAssumed Answered

Same category,different path

Question asked by bep on Aug 6, 2013
Hello! Don't know if this is the correct section for my question,so sorry if it's not.
I'm trying to assign categories to content in Alfresco community, using javascript API to create categories and subcategories and then adding the aspect to content.
Now I'm facing the following problem, trying to solve it without result for now so I need some help…
I've created two categories with the same name but in different path,e.g.

generalclassifiable/path1/category
generalclassifibale/path2/category

when adding both to an item in Alfresco the system only adds one,although their path is different and obviously they have different reference.
So is the correct behaviour for Alfresco,and for me there's nothing to do but changing the name of one category or there is a way to add to an item two categories with same name but different paths?
Thanks to all!


EDIT:
ok, adding some lines and messages I discovered that from the array I use for categories, duplicates are removed.I'll explain better the whole thing adding more details:
1)I get all category nodes using getAllCategoryNodes command;
2)then use a FOR loop on all category nodes;
3)by IF I check if the name of category is the one I want and check the path also: if it's ok I put the category node into an array.At this point I'm able to see that the array contains both category(that have the same name but different path,just to remember);
4)at the end of the FOR loop the array contains only ONE category:so it's like the other is being removed from it.

So now I'm blocked :(
Anyone can help?Thanks

EDIT 2:
ok solved.My fault:there was an identical word in the two paths so the .search method on the string found one of them randomly.
I've fixed it now it works,assigning the two categories correctly.
Sorry :)

Outcomes