Page 1 of 2
Property group
PostPosted:Tue Jan 28, 2014 4:28 pm
by vincentk222
I'm testing the possibilities of property group
I had look on Form Element Description
I tested succesfully the "Suggestbox" but "Select" do not work
here is the definition :
Code: Select all <select label="Provincia" name="okp:provincia" type="simple"
table="provincia"
optionsQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia'"/>
Is there somewhere example with iframe?
Re: Property group
PostPosted:Wed Jan 29, 2014 6:29 pm
by jllort
Iframe feature is only available from version 6.4 ( professional editon ).
Have you executed the inserts described at
http://wiki.openkm.com/index.php/Form_E ... escription:
Code: Select all-- NORMAL
DELETE FROM OKM_DB_METADATA_TYPE WHERE DMT_TABLE='provincia';
INSERT INTO OKM_DB_METADATA_TYPE (DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES ('provincia', 'col00', 'integer', 'pro_id');
INSERT INTO OKM_DB_METADATA_TYPE (DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES ('provincia', 'col01', 'text', 'pro_nombre');
-- SOME DATABASES NEED SET DMT_ID, LIKE ORACLE
DELETE FROM OKM_DB_METADATA_TYPE WHERE DMT_TABLE='provincia';
INSERT INTO OKM_DB_METADATA_TYPE (DMT_ID, DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES (HIBERNATE_SEQUENCE.NEXTVAL, 'provincia', 'col00', 'integer', 'pro_id');
INSERT INTO OKM_DB_METADATA_TYPE (DMT_ID, DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES (HIBERNATE_SEQUENCE.NEXTVAL, 'provincia', 'col01', 'text', 'pro_nombre');
the metadata field should be:
Code: Select all<select label="Provincia" name="okp:provincia" type="simple" table="provincia"
optionsQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia'"/>
Re: Property group
PostPosted:Thu Jan 30, 2014 8:49 am
by vincentk222
Yes I did execute the NORMAL sql script.
I checked the metadata table and everything seems OK
I still get this error :
Application error
Class: com.openkm.core.ParseException
Message: Attribute "table" must be declared for element type "select".
Date: Thu Jan 30 09:44:08 CET 2014
Note: I did the test with the Suggestbox and it works fine.
here is my PropertyGroups.xml
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="Name" 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="Technology" name="okg:technology">
<select label="Type" name="okp:technology.type" type="multiple">
<option label="Alfa" value="t1"/>
<option label="Beta" value="t2" />
<option label="Omega" value="t3" />
</select>
<select label="Language" name="okp:technology.language" type="simple">
<option label="Java" value="java"/>
<option label="Python" value="python"/>
<option label="PHP" value="php" />
</select>
<input label="Comment" name="okp:technology.comment"/>
<textarea label="Description" name="okp:technology.description"/>
<input label="link" type="link" name="okp:technology.link"/>
</property-group>
<property-group label="Demo" name="okg:demo">
<select label="Provincia" name="okp:provincia" type="simple"
table="provincia"
optionsQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia'"/>
</property-group>
</property-groups>
Re: Property group
PostPosted:Sat Feb 01, 2014 4:40 pm
by jllort
Re: Property group
PostPosted:Tue Feb 04, 2014 10:49 am
by vincentk222
Yes
Thanks , it works now.
Vincent
Re: Property group
PostPosted:Thu Sep 10, 2015 3:15 pm
by intel74
hi
I've a similar problem with SELECT elemen .... no one error displayed but drop down was empty.
I followed example
If I use SUGGESTBOX it run perfectly but with SELECT nothig to do...
Code: Select all<select label="Provincia" name="okp:fatturaemessa.provincia" type="simple"
table="provincia" suggestion="com.openkm.form.suggestion.DocumentContentTokenizerSuggestion"
optionsQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia'"/>
any idea?
thanks in advance
Re: Property group
PostPosted:Fri Sep 11, 2015 9:25 pm
by jllort
Take this as example ( I think your previous definition was right ):
Code: Select all<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.5//EN"
"http://www.openkm.com/dtd/property-groups-2.5.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<select label="country" name="okp:consulting.country" type="simple"
table="country"
optionsQuery="select $country_id, $country_name from DatabaseMetadataValue dmv where dmv.table='country' order by $country_name"/>
</property-group>
</property-groups>
Try first without suggestion="com.openkm.form.suggestion.DocumentContentTokenizerSuggestion" and later with suggestion ( if then is not going right we will have isolated the problem ).
Re: Property group
PostPosted:Mon Sep 14, 2015 8:56 am
by intel74
thanks for your help, I followed your instructions but the result is the same
I attach the screenshot and there you can see the definition of the property group:
Code: Select all<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.5//EN"
"http://www.openkm.com/dtd/property-groups-2.5.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<select label="Provincia" name="okp:consulting.country" type="simple"
table="country" optionsQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia' order by $pro_nombre"/>
<suggestbox label="Provincia" name="okp:consulting.provincia2" width="200px"
table="provincia" dialogTitle="Seleccionar Provincia" filterMinLen="3"
filterQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia' and lower(dmv.$pro_nombre) like '%{0}%' order by dmv.$pro_nombre"
valueQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia' and dmv.$pro_nombre='{0}'" />
</property-group>
I think it is a trivial problem but I do not understand what
thanks again
Re: Property group
PostPosted:Wed Sep 16, 2015 7:15 am
by jllort
which OpenKM version are you using ?
Re: Property group
PostPosted:Thu Sep 17, 2015 1:30 am
by intel74
I'm using the Community version 6.3 on Windows Server 2011 and MS SQL 2008 sp4
I begin to think that the problem is due to the db, Perhaps the compatibility with sql is not complete
I tried to use the same metadata definitions in a workflow form. The behavior is the same, select box was empty while suggest box fill box correctly but if i fill form and click on button to submit form the system show an error that i do not understand.(you can ycheck screenshots attached)
I don't know the DB Layer but it seems that a sql command or store procedure goes wrong
thank you so much for your availability
Re: Property group
PostPosted:Fri Sep 18, 2015 11:10 am
by jllort
Post here your form.xml and also go to Administration > Database query and execute :
SELECT * FROM okm_db_metadata_type;
Re: Property group
PostPosted:Fri Sep 18, 2015 10:22 pm
by intel74
Code: Select all<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.4//EN" "http://www.openkm.com/dtd/workflow-forms-2.4.dtd">
<workflow-forms>
<workflow-form task="Inserimento">
<input label="Numero Fattura" type="text" name="numeroFattura">
<validator type="req"/>
</input>
<input label="Data Fattura" type="date" name="dataFattura">
<validator type="req"/>
</input>
<suggestbox label="FORNITORE" name="fornitoreFattura" width="200px" table="FORNITORE" dialogTitle="Seleziona il fornitore" filterMinLen="3"
filterQuery= "select $fornitore_id, $fornitore_ragionesociale, $fornitore_piva from DatabaseMetadataValue dmv where dmv.table='FORNITORE' and lower(dmv.$fornitore_ragionesociale) like '%{0}%' order by dmv.$fornitore_ragionesociale"
valueQuery="select $fornitore_id, $fornitore_ragionesociale, $fornitore_piva from DatabaseMetadataValue dmv where dmv.table='FORNITORE' and dmv.$fornitore_id='{0}'" />
<input label="Imponibile" type="text" name="imponibileFattura">
<validator type="dec"/>
</input>
<input label="% IVA" name="ivaFattura">
<validator type="num"/>
</input>
<select label="Tipo di pagamento" name="tipopagamentoFattura" type="simple">
<option label="Per cassa" value="1"/>
<option label="Carta di credito" value="2"/>
<option label="Bonifico anticipato" value="3"/>
<option label="Bonifico posticipato" value="4"/>
<option label="Assegno" value="5"/>
<option label="Altro" value="6"/>
</select>
<suggestbox label="Centro di costo" name="ccFattura" width="200px" table="CENTRO_COSTO" dialogTitle="Seleziona il centro di costo" filterMinLen="0"
filterQuery= "select $centro_costo_id, $centro_costo_descrizione from DatabaseMetadataValue dmv where dmv.table='CENTRO_COSTO' and lower(dmv.$centro_costo_descrizione) like '%{0}%' order by dmv.$centro_costo_descrizione"
valueQuery="select $centro_costo_id, $centro_costo_descrizione from DatabaseMetadataValue dmv where dmv.table='CENTRO_COSTO' and dmv.$centro_costo_id='{0}'" />
<input label="Note" name="noteFattura" />
<select label="Stato Fattura" name="fatturaStato" type="simple">
<option label="Validazione" value="1"/>
<option label="Registrazione" value="2" />
<option label="Approvazione" value="3" />
<option label="In Pagamento" value="4" />
<option label="Pagata" value="5" />
<option label="Scartata" value="6" />
<option label="Contestata" value="7" />
<option label="Parzialmente Pagata" value="8" />
</select>
<input label="Numero" type="text" name="protocollonumeroregistro" >
<validator type="num" />
</input>
<input label="Data" type="date" name="protocollodataregistro" >
</input>
<button name="submit" label="Invio" />
</workflow-form>
<workflow-form task="Approvazione">
<button name="submit" label="Approva" />
<button name="submit" label="Rigetta" />
</workflow-form>
<workflow-form task="registrazione">
<input label="Numero Registrazione" type="text" name="nRegistroFattura" >
<validator type="req"/>
<validator type="num" />
</input>
<input label="Data Registrazione" type="date" name="dataRegistroFattura" >
<validator type="req"/>
</input>
<button name="submit" label="Ok" />
</workflow-form>
</workflow-forms>
Re: Property group
PostPosted:Sat Sep 19, 2015 5:32 pm
by jllort
Tree suggestions:
1- try to change $centro_costo_id, $centro_costo_descrizione to dmv.$centro_costo_id, dmv.$centro_costo_descrizione
2- change type integer to text ( OKM_DB_METADATA_TYPE of col00 )
3- is a good practice use 001, 002 until 999 on option values, otherwise when search by lucene you will get incorrect results ( for example when looking for value 1, also will be retrieved 11, 12, etc... if you normalize with 0 at the begining the value of chain is distinct for each value and lucene will retrieve you correct results ).
If the error persists, will be interesting get see the comple error from catalina.log
Re: Property group
PostPosted:Sun Sep 27, 2015 4:42 pm
by intel74
hi jllort
your first suggestion solved my problem!!! now it works perfectly!
thanks a lot for your help
Re: Property group
PostPosted:Mon Sep 28, 2015 2:36 pm
by intel74
i forgot to specify... I solved problem about suggestbox, but I still have problems with the select box
using suggest box i found value in the box... using selectbox the dropdown list was empty.