Custom vocabulary with custom columns


I am trying to create a new vocabulary extracting the data from a table I have in my database, but I am having problems with operations like “Directory.Suggestion”, and with methods like “formatDirectory()“. The problem is my table doesn't have “ID” and “LABEL” columns. Instead of those columns, it has custom columns named “id_j” and “description”, and I cannot change them (because other applications use them).

I have defined my directory:

<directory name="myVocabulary" extends="default-template-directory">

I have defined the “tm_vocabulary” schema:

<?xml version="1.0"?>

<xs:schema targetNamespace=""

    <xs:element name="id_j" type="xs:string"/>
    <xs:element name="description" type="xs:string"/>


And I also have added the schema:

<schema name="tm_vocabulary" prefix="tmv" src="schema/directories/tm_vocabulary.xsd" />

Going to “Vocabularies” in the Nuxeo WebUI, I can see the vocabulary and its eantries without any problem. However, in one view, I have the following element:

        label="My property" 
        min-chars="0" required>

And this element is not working, because it is invoking “Directory.Suggestion”, and this operation says “'label' column cannot be found”. What can I do to use the nuxeo-directory-suggestion element with my custom vocabulary?

Thank you.

0 votes

1 answers



Vocabularies in Nuxeo require the standard id and label columns. The standard solution to this problem is to define a VIEW in your SQL database to have a new virtual table with the required columns that points to your existing table.

1 votes

Definitely the best solution. Tested and working. Thank you!