• Can't get metadata select working

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #48440  by stiebs
 
I'm trying to set up a metadata category that has a data-driven selection, but following the docs, can't seem to get it to work.

Below is my property group XML, and I have attached the contents of OKM_DB_METADATA_TYPE and OKM_DB_METADATA_VALUE.

If I use the select, I get a parse error so can't even save the XML.
Class: com.openkm.core.ParseException
Message: Attribute "table" must be declared for element type "select".
Code: Select all
    
    <select
            table="suppliers" label="Supplier" name="okp:bill.supplier" 
            suggestion="com.openkm.form.suggestion.DocumentContentTokenizerSuggestion"
            optionsQuery="select $sup_id, $sup_name from DatabaseMetadataValue dmv where dmv.table='suppliers' " />
Edit:
I'm using Community Edition 6.3.8
 #48452  by jllort
 
Please attach your entire definition into a txt file.
Also execute from Database query the query ( share results here ):
Code: Select all
SELECT * FROM OKM_DB_METADATA_TYPE
 #48459  by stiebs
 
Here is the full XML file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.0//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.0.dtd">
<property-groups>
  <property-group label="Consulting" name="okg:consulting">
    <input label="Name" type="text" name="okp:consulting.name"/>
    <input label="Date" type="date" name="okp:consulting.date" />
    <checkbox label="Important" name="okp:consulting.important"/>
    <textarea label="Comment" name="okp:consulting.comment"/>
  </property-group>

 <property-group label="Bill" name="okg:bill">
    <input label="Supplier" type="text" name="okp:bill.supplier" />
       
     <select
            table="suppliers" label="Suppliertest" name="okp:bill.suppliertest" 
            suggestion="com.openkm.form.suggestion.DocumentContentContainsSuggestion"
            optionsQuery="select $sup_id, $sup_name from DatabaseMetadataValue dmv where dmv.table='suppliers' " />
    
     <input label="Service" type="text" name="okp:bill.service"/>
    <input label="Amount" type="text" name="okp:bill.amount"/>
    <input label="Issue Date" type="date" name="okp:bill.issuedate" />
    <input label="Due Date" type="date" name="okp:bill.duedate" />
    <checkbox label="Paid?" name="okp:bill.ispaid"/>
     <input label="Date Paid" type="date" name="okp:bill.paiddate" />
    <textarea label="Comment" name="okp:bill.comment"/>
  </property-group>
             
</property-groups>
And attached is output of METADATA_TYPE and METADATA_VALUE
Attachments
OKM_DB_METADATA_TYPE.png
OKM_DB_METADATA_TYPE.png (4.92 KiB) Viewed 3253 times
OKM_DB_METADATA_VALUE.png
OKM_DB_METADATA_VALUE.png (3.48 KiB) Viewed 3253 times
 #48482  by jllort
 
Two suggestions:
1- Use text either integer, because for Lucene when you search for value 1 will be found also 12, 11, 101 ( any key with 1 ) -> consider these are words ( text and the end ) a good practice is "001", "002", etc..
2- I suggest remove the suggestion="com.openkm.form.suggestion.DocumentContentContainsSuggestion" and when you got running default configuration might play with this extra configuration

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.