Params Select field
Attribute | Description | Required |
---|---|---|
label |
The text is shown as a label in the user interface. |
true |
name |
Unique field identifier. Two fields can't have the same name in the exact task definition. The name must be unique. |
true |
type |
Type value. Allowed types:
|
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, UI must use width values based on %, for example:
|
false |
height |
The height of the HTML element. | false |
optionsQuery |
A metadata query or SQL query is used to get the select options. | * |
Child elements:
|
||
* There're two options to get option values:
One of these options must be defined. Otherwise, you will get an error. A combination of several cannot be done, only one can be chosen. |
Basic select example
- 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>
Allow multiple choice
- 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>
Hierarchical relationship
- The field options values of "childrenSelect" have parent relation with "parentSelect." It's defined by parentElement="parentSelect".
- The option value "benefits" of the field "childrenSelect" has a parent value "directives" from the area "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
Based on SQL query
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');
Based on className
To help get a list from external applications or 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.
Suggested options
Based on the content analyzer, the application can suggest some options values. At 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>