Can't get metadata select working

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.
Post Reply
stiebs
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Fri Jun 15, 2012 12:26 pm

Can't get metadata select working

Post 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

jllort
Moderator
Moderator
Posts: 11204
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Can't get metadata select working

Post 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

stiebs
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Fri Jun 15, 2012 12:26 pm

Re: Can't get metadata select working

Post 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 2051 times
OKM_DB_METADATA_VALUE.png
OKM_DB_METADATA_VALUE.png (3.48 KiB) Viewed 2051 times

jllort
Moderator
Moderator
Posts: 11204
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Can't get metadata select working

Post 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

Post Reply