Page 1 of 1

Can't get metadata select working

PostPosted:Thu Jul 18, 2019 11:57 am
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

Re: Can't get metadata select working

PostPosted:Fri Jul 19, 2019 6:28 pm
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

Re: Can't get metadata select working

PostPosted:Sun Jul 21, 2019 3:17 am
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

Re: Can't get metadata select working

PostPosted:Thu Jul 25, 2019 7:34 am
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