Skip to content
Other versions

Loading…

Workflow Select field

Attribute Description Required
label The text is shown as a label in the user interface. true
name Unique field identifier.
Two areas 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.
For 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 SQL query is used to get the select options. *
className A class is used to get the select options. *
data When present, it is an identifier used to load data. false
optionsData When present, it is an identifier used to load options. false
readonly The field cannot be modified in the user interface. By default, the value is “false”. false
  • * There are three options to get option values:

  • Child elements:

  • Type is equal to simple.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.13//EN"
"http://www.openkm.com/dtd/workflow-forms-2.13.dtd">
<workflow-forms>
<workflow-form task="select test">
<select label="select label" name="select" type="simple">
<option label="one" value="001" />
<option label="two" value="002" />
<option label="three" value="003" />
</select>
</workflow-form>
</workflow-forms>
  • Type is equal to multiple.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.13//EN"
"http://www.openkm.com/dtd/workflow-forms-2.13.dtd">
<workflow-forms>
<workflow-form task="select test">
<select label="select label" name="select" type="multiple" >
<option label="one" value="001" />
<option label="two" value="002" />
<option label="three" value="003" />
</select>
</workflow-form>
</workflow-forms>

We can also get these option values using a SQL query. This SQL statement should be placed in 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 workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
"http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
<workflow-form task="select test">
<select label="country" name="country" type="simple"
optionsQuery="select CT_ID, CT_NAME from COUNTRY order by CT_NAME"/>
</workflow-form>
</workflow-forms>

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 get a list from external applications or for other purposes, you can build your class to retrieve the option values from these systems.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
"http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
<workflow-form task="select test">
<select label="select label" name="okp:consulting.select" type="simple"
className="com.openkm.plugin.form.values.OptionSelectUserList" />
</workflow-form>
</workflow-forms>

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

  • The field option value “childrenSelect” has a parent relationship with “parentSelect”. It’s defined by parentElement=“parentSelect”
  • The option value “benefits” of the field “childrenSelect” has a parent value “directives” from the field “parentSelect”.

Tree relationships:

  • directives
    • benefits
    • eligibility
    • services
  • handbook
    • basic
    • normal
    • advanced
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.13//EN"
"http://www.openkm.com/dtd/workflow-forms-2.13.dtd">
<workflow-forms>
<workflow-form task="select test">
<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>
</workflow-form>
</workflow-forms>

We use a couple of tables to get the information in this case.

create table LOCALIDAD (
LOC_ID varchar(8),
LOC_NAME varchar(32),
primary key (LOC_ID)
);
create table UBICACION (
UBI_ID varchar(8),
UBI_LOC varchar(8),
UBI_NAME varchar(32),
primary key (UBI_ID)
);
insert into LOCALIDAD (LOC_ID, LOC_NAME) values ('l0', 'Localidad 0');
insert into LOCALIDAD (LOC_ID, LOC_NAME) values ('l1', 'Localidad 1');
insert into LOCALIDAD (LOC_ID, LOC_NAME) values ('l2', 'Localidad 2');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u0', 'l0', 'Ubicación 0');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u1', 'l0', 'Ubicación 1');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u2', 'l0', 'Ubicación 2');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u3', 'l1', 'Ubicación 4');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u4', 'l1', 'Ubicación 5');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u5', 'l1', 'Ubicación 6');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u6', 'l2', 'Ubicación 7');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u7', 'l2', 'Ubicación 8');
insert into UBICACION (UBI_ID, UBI_LOC, UBI_NAME) values ('u8', 'l2', 'Ubicación 9');

 This is the form definition:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.13//EN"
"http://www.openkm.com/dtd/workflow-forms-2.13.dtd">
<workflow-forms>
<workflow-form task="task">
<!-- Parent child -->
<select name="localidad" label="Localidad" optionsQuery="select LOC_ID, LOC_NAME from LOCALIDAD" />
<select name="ubicacion" label="Ubicacion" parentElement="localidad" optionsQuery="select UBI_ID, UBI_NAME, UBI_LOC from UBICACION" />
</workflow-form>
</workflow-forms>