Unable to find field num_bc in directory schema bc. Trying to fallback on default one. [Nuxeo]

What I'm trying to do is to populate a dropdownlist from database (num_bc). I added the schema bc, I registered it, and I created a new Directory bc_directory. All is good I can see the values on the Dropdown list but once I click on it I can't select its value.

Here's the log content:

[org.nuxeo.ecm.platform.ui.select2.common.Select2Common] Unable to find field num_bc in directory schema bc. Trying to fallback on default one.

Here's my Code: Schema:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://sample.nuxeo.org/sample/schemas/bc/"
  xmlns:bc="http://sample.nuxeo.org/sample/schemas/bc/">

  <xs:element name="num_bc" type="xs:string"/>
  <xs:element name="date" type="xs:date"/>
  <xs:element name="fournisseur" type="xs:string"/>
  <xs:element name="code_fournisseur" type="xs:string"/>
  <xs:element name="entreprise" type="xs:string"/>
  <xs:element name="produit" type="xs:string"/>
  <xs:element name="quantite" type="xs:string"/>
  <xs:element name="montant_total" type="xs:string"/>
  <xs:element name="prix_unitaire" type="xs:string"/>
  <xs:element name="obsolete" type="xs:string"/>

</xs:schema>

BL schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://sample.nuxeo.org/sample/schemas/bl/"
  xmlns:bl="http://sample.nuxeo.org/sample/schemas/bl/">

  <xs:element name="num_bc" type="xs:string"/>
  <xs:element name="num_bl" type="xs:string"/>
  <xs:element name="date" type="xs:date"/>
  <xs:element name="client" type="xs:string"/>
  <xs:element name="code_client" type="xs:string"/>
  <xs:element name="ref" type="xs:string"/>
  <xs:element name="quantite" type="xs:string"/>
  <xs:element name="montant_total" type="xs:string"/>
  <xs:element name="prix_unitaire" type="xs:string"/>
  <xs:element name="transporteur" type="xs:string"/>
  <xs:element name="code_transporteur" type="xs:string"/>

</xs:schema>

Schema registrations:

<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
    <schema name="bc" src="schemas/bc.xsd" />
</extension>

I searched for the error generated, I found that I have to delete the prefix on schema I did not working though.

<extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory"
    point="directories">
    <directory name="bc_directory">
                    <schema>bc</schema>
                    <dataSource>java:/nxsqldirectory</dataSource>
                    <table>bc</table>
                    <nativeCase>false</nativeCase>
                    <idField>num_bc</idField>
                    <autoincrementIdField>false</autoincrementIdField>
                    <createTablePolicy>on_missing_columns</createTablePolicy>
                    <querySizeLimit>1000</querySizeLimit>
    </directory>

</extension>

Layout contribution:

<component name="org.nuxeo.project.sample.layouts">

    <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager" point="widgets">
        <widget name="num_bc" type="suggestOneDirectory">
                        <labels>
                          <label mode="any">Numéro BC</label>
                        </labels>
                        <translated>true</translated>
                        <fields>
                          <field>bl:num_bc</field>
                        </fields>
                        <properties mode="any">
                          <property name="width">300</property>
                          <property name="labelFieldName">num_bc</property>
                          <property name="dbl10n">true</property>
                          <property name="minChars">0</property>
                          <property name="hideHelpLabel">true</property>
                          <property name="directoryName">bc_directory</property>
                          <property name="keySeparator">/</property>
                          <property name="placeholder">Num bc</property>
                          <property name="documentSchemas">dublincore,layout_demo_schema</property>
                          <property name="repository">default</property>
                        </properties>
                        <controls mode="any">
                          <!-- enable ajax submit on change/click/select on demo application -->
                          <control name="supportInsideInputWidgetEffects">true</control>
                        </controls>
        </widget>

    </extension>

</component>
0 votes

1 answers

4879 views

ANSWER



You say:

<field>bl:num_bc</field>

Where does that bl comme from?

Also you should always explicitly define the prefix when defining the schema:

<schema name="bc" prefix="bc" src="schemas/bc.xsd" />
0 votes



I updated the post and added the BL schema; in the layout of the BL I want to add a list of Bc (NumBc). and for the prefix I had it at first and deleted it after I searched for the error not working in both cases.
06/16/2015