cancel
Showing results for 
Search instead for 
Did you mean: 

Categories

mattousai
Champ in-the-making
Champ in-the-making
When I have some content that is classified in a category, the properties array will contain an entry for that category. The only problem is that the category is just a  string containing an id (workspace://SpacesStore/8ca130f4-ef92-11dc-9061-c7313d82e911)

I need the human-readable name of that category. Is there any way to get that name by using the id string in the content's property array?
4 REPLIES 4

jbarmash
Champ in-the-making
Champ in-the-making
When I have some content that is classified in a category, the properties array will contain an entry for that category. The only problem is that the category is just a  string containing an id (workspace://SpacesStore/8ca130f4-ef92-11dc-9061-c7313d82e911)

I need the human-readable name of that category. Is there any way to get that name by using the id string in the content's property array?

It's not clear where you need it - I am assuming in code. 

You can do that programatically - look up the node based on id, and check the node's cm:name property.    Another way, if you are bootstrapping categories, is that you can assign uuids as meaningful names- see record management module's default categories for how that's done.

mattousai
Champ in-the-making
Champ in-the-making
yeah, i am talking about in code (sorry for the lack of clarity), and am just working off of the basic tutorial three script.

After adding a category via the web ui and then running the test script, the table filled with properties about that Alfresco-Tutorial.pdf has the category listed as a property, but the category is just a node id. I will look into the records management module, and in the meantime, is there a line of code that would return that a string with the corresponding name

lets say i have something like this:

$category = $contentNode->properties['{http://www.alfresco.org/model/content/1.0}categories'];

$category will contain a string like: workspace://SpacesStore/7c086268-ef92-11dc-9061-c7313d82e911

what would be the syntax for looking up the node and finding its cm_name?
$name = new Node($category)->cm_name; ???

jbarmash
Champ in-the-making
Champ in-the-making
From the snippet you provided, which language is this? php? 

I believe that in FreeMarker API (and probably others) if you ask for the categories property, you will get a list of nodes (each node is a category). You can then get the name property of the new node. 

Does that help?   If not, and all you get is UUID, you can use search service to look it up, and get the name of the node.

mattousai
Champ in-the-making
Champ in-the-making
yeah, it does just give the uuid, but i am able to get the name from the search. Thanks for your responses 🙂
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.