Skip to content

Params Select field

Attribute Description Required
label The text is shown as a label in the user interface. true
name A unique field identifier.
Two fields can’t have the same name in the same task definition. The name must be unique.
true
type Type value. Allowed types:
- Simple (single choice allowed).
- Multiple (multiple selections allowed).
true
table Metadata table name.
The application can store values in a metadata table that can be used in this query.
*
width The width of the HTML element.
In the case of KCenter, the UI must use width values based on %, for example:
- width=“50%” will work.
- width=“100px” will be ignored in the KCenter UI.
false
height The height of the HTML element. false
optionsQuery A metadata query or an SQL query is used to get the select options. *
  • * There are two options to get option values:

  • Child elements:

  • Type is equal to simple.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE report-parameters PUBLIC "-//OpenKM//DTD Report Parameters 2.1//EN"
"http://www.openkm.com/dtd/report-parameters-2.1.dtd">
<report-parameters>
<select label="select label" name="select" type="simple">
<option label="one" value="001" />
<option label="two" value="002" />
<option label="three" value="003" />
</select>
</report-parameters>
  • Type is equal to multiple.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE report-parameters PUBLIC "-//OpenKM//DTD Report Parameters 2.1//EN"
"http://www.openkm.com/dtd/report-parameters-2.1.dtd">
<report-parameters>
<select label="select label" name="select" type="multiple">
<option label="one" value="001" />
<option label="two" value="002" />
<option label="three" value="003" />
</select>
</report-parameters>
  • The field option values of “childrenSelect” have a parent relation with “parentSelect”. It’s defined by parentElement=“parentSelect”.
  • The option value “benefits” of the field “childrenSelect” has a parent value “directives” in the field “parentSelect”.

Tree relationships:

  • directives
    • benefits
    • eligibility
    • services
  • handbook
    • basic
    • normal
    • advanced
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE report-parameters PUBLIC "-//OpenKM//DTD Report Parameters 2.1//EN"
"http://www.openkm.com/dtd/report-parameters-2.1.dtd">
<report-parameters>
<select label="Parent" name="parentSelect" type="simple">
<option value="directives" label="Directives" />
<option value="handbook" label="Handbook Paragraphs" />
</select>
<select label="Children" name="childrenSelect" type="simple" parentElement="parentSelect">
<option value="benefits" label="Benefits" parentValue="directives" />
<option value="elegibility" label="Eligibility" parentValue="directives" />
<option value="services" label="Services" parentValue="directives" />
<option value="basic" label="Basic" parentValue="handbook" />
<option value="normal" label="Advanced" parentValue="handbook" />
<option value="advanced" label="Normal" parentValue="handbook" />
</select>
</report-parameters

We can also get these option values using an SQL query. This SQL sentence should be put on the optionsQuery attribute, but the table attribute should be empty (otherwise, this query is a metadata query). Note that the first element returned in every row is the option value, and the second is the option label.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE report-parameters PUBLIC "-//OpenKM//DTD Report Parameters 2.1//EN"
"http://www.openkm.com/dtd/report-parameters-2.1.dtd">
<report-parameters>
<select label="country" name="country" type="simple"
optionsQuery="select CT_ID, CT_NAME from COUNTRY order by CT_NAME" />
</report-parameters>

The table used in this sample is defined as follows:

create table COUNTRY (
CT_ID varchar(2),
CT_NAME varchar(32),
primary key(CT_ID)
);insert into COUNTRY (CT_ID, CT_NAME) values ('es', 'Spain');insert into COUNTRY (CT_ID, CT_NAME) values ('pt', 'Portugal');insert into COUNTRY (CT_ID, CT_NAME) values ('it', 'Italy');

To help get a list from external applications or for other purposes, your class can be built to retrieve the option values from those systems.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE report-parameters PUBLIC "-//OpenKM//DTD Report Parameters 2.1//EN"
"http://www.openkm.com/dtd/report-parameters-2.1.dtd">
<report-parameters>
<select label="select label" name="okp:consulting.select" type="simple"
className="com.openkm.plugin.form.values.OptionSelectUserList" />
</report-parameters>

For more information, read Creating your own Option Select Values plugin.

Based on the content analyzer, the application can suggest some option values. In the user interface, the recommended options will be shown in green.

The application has some implementations that can easily be extended.

  • com.openkm.form.suggestion.DocumentContentContainsSuggestion: Get suggestions based on document content (use String.contains)
  • com.openkm.form.suggestion.DocumentContentTokenizerSuggestion: Get suggestions based on document content (use StringTokenizer).
  • com.openkm.form.suggestion.DocumentTermsSuggestion: Get suggestions based on document term vectors.

For more information, read Creating your own Suggestion Analyzer.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE report-parameters PUBLIC "-//OpenKM//DTD Report Parameters 2.1//EN"
"http://www.openkm.com/dtd/report-parameters-2.1.dtd">
<report-parameters>
<select label="select label" name="okp:consulting.select" type="multiple"
suggestion="com.openkm.form.suggestion.DocumentContentContainsSuggestion">
<option label="one" value="001" />
<option label="two" value="002" />
<option label="three" value="003" />
</select>
</report-parameters>