Use the Select Multiple Values dialog
Use the Select Multiple Values dialog
Technologies / Software Engineering Techniques / Software Engineer Views / Custom Controls (label) / Wizard Form Style
The standard Select Value dialog has a Select Multiple Values option for enabling users to select multiple values at once. For example, when selecting value for the County field in the search console, the user can choose multiple country codes.
You can enable the Select Multiple Values option for any text field in a console panel. When this option is enabled, users can select multiple items using the standard Select Value dialog with either a single restriction value, such as
State = MA
or multiple restriction values, such as,
State IN (MA, NH, VA
).
When standard view commands (such as,
showPanel
or
selectTab
) are used, the console automatically generates the
IN
restriction clause if the user has entered multiple values in the field.
Multiple Value Separators
All text fields that have Select Value dialogs with multiple selection enabled display values separated by commas. (In previous versions these fields displayed values separated by ^ symbols.)
Because some database values, such as employee IDs, may contain commas, the form adds hidden HTML characters between values in order to be able to create correct restrictions from multiple values. The actual separator is
, \u200C
. Users cannot enter the hidden HTML characters manually, and must use the Select Value dialog in order to select multiple values.
Multi-edit Fields
If the user can enter many values into a text field, we recommend that you also enable multiple value editing for the field:
<fieldname = "dp_id" controlType="multiEdit">
This makes the field:
- Display the "any" placeholder when empty.
- Automatically increase the height if the values do not fit on line. Note that users must use the Select Value dialog to select multiple values.
Displaying Field Actions Below the Field
For fields that may contain many values, you might also want to display the Select Value action below the field. Add the
actionsPosition
property to the field:
<field name="dp_id" controlType="multiEdit" actionsPosition="bottom">
AXVW Format
To enable this option in the AXVW file, add the
selectValueType
=
"multiple"
attribute to the
<field>
element of the console panel. The
multiple
value is only valid for panels of type
console
.
<field name="state_id" selectValueType="multiple">
JavaScript API
You can also get or set multiple field values from your Java Script code.
Typically the application JS code calls the console.
getFieldsRestriction()
method that returns the
Ab.view.Restriction
object. This method supports multiple values clauses.
var restriction = console.getFieldsRestriction();
grid.refresh(restriction);
You can create multiple values restriction clauses using the console panel methods:
if (console.hasFieldMultipleValues('bl.site_id')) {
var valuesArray = console.getFieldMultipleValues('bl.site_id');
restriction.addClause('bl.site_id', valuesArray, 'IN', 'AND');
} else {
var value = console.getFieldValue('bl.site_id');
restriction.addClause('bl.site_id', value, '=', 'AND');
}
The
hasFieldMultipleValues(fieldName)
method returns
true
if the user has entered multiple values into specified field; it returns
false
if the user has entered a single value or no value.
The
getFieldMultipleValues(fieldName)
method returns a JS array of strings, containing values the user entered into specified field. If the user has entered a single value, the array has one element. If the user has entered no value, the array is empty.
The
setFieldMultipleValues(fieldName, values)
method saves specified JS array of string values into specified field.
View: http://localhost:8080/archibus/schema/ab-products/solutions/programming/html/ab-ex-wizard-style.axvw