Altova StyleVision 2024 Enterprise Edition

A combo box presents the Authentic View user with a list of options entries in a dropdown list. The selected option is mapped to a value that is entered in the XML document. The mapping of drop-down list entry to XML value is specified in the SPS.

 

Mappings can be made in the Edit Combo Box dialog in one of three ways:

 

From the schema enumerations for the selected node. In this case, the visible entry (in the dropdown list) will be the same as the XML value.

From a list defined in the Edit Combo Box dialog. You enter the visible entry and the corresponding XML value, which may be different.

From the result sequence of an XPath expression relative to the current node. The items in the result sequence are displayed as the entries of the drop-down list, and the list entry selected by the Authentic View user is entered as the value of the node. This is a powerful method of using dynamic entries in the combo box. The node that you create as the combo box is important. For example, say you have a NameList element that may contain an unlimited number of Name elements, which themselves have First and Last children elements. If you create the Name element as a combo box, and select the Last child element for the list values, then, in Authentic View, you will get as many combo boxes as there are Name elements and each combo box will have the Last child as its dropdown menu entry. In order to get a single combo box with all the Last elements in the dropdown menu list, you must create the single NameList element as the combo box, and select the Last element in the XPath expression.

 

Accessing the Edit Combo Box dialog

If you are creating a new combo box, when you create the node as a combo box, the Edit Combo Box dialog pops up. You can also insert a combo box with the  (Insert | Insert Form Controls | Combo Box) menu command. To access the Edit Combo Box dialog afterwards, do the following:

 

1.Select the combo box in the design.

2.In the Properties sidebar, select the combo box item and then the combo box group of properties (see screenshot below).

 

WinPropsComboBoxEdit

 

3.Click the Edit button BtnEdit of the the content origin property. This pops up the Edit Combo Box dialog.

 

Using the Edit Combo Box dialog

The Edit Combo Box dialog is shown below.

 

Click to expand/collapse

 

To define the entries and values for the combo box, do the following:

 

1.Select the method with which you wish to define the entries and values by clicking the appropriate radio button: (i) schema enumerations, (ii) list of values, or (iii) XPath expressions to select values.
2.If you select Schema Enumerations, the enumerations assigned to that node in the schema are entered automatically as (i) the visible entries  of the drop-down list of the combo box, and (ii) the corresponding XML values (screenshot below). Visible Entries are the entries in the drop-down list of the combo box. Each drop-down list entry has a corresponding XML value. The XML value corresponding to the visible entry that the Authentic user selects will be the XML value that is entered in the XML file. Both visible entries and XML values are grayed out in the list of values because they are both obtained from the schema enumerations and cannot be edited.

 

dlg_edit_combobox_enums

 

If you select Use List of Values, you can insert, append, edit, and delete any number of entries for the drop-down list of the combo box as well as for the corresponding XML values. These edits are carried out in the pane below the Use List of Values radio button. You could also use an XPath expression to create the visible entries and XML values. The items in the sequence returned by the XPath expression will be used for visible entries and XML values. You can specify: (i) that the same XPath expression be used for visible entries and XML values, or (ii) that different XPath expressions be used. In the latter case, a one-to-one index mapping between the items of the two sequences determines the correspondence of visible entry to XML value. If the number of items in the two sequences are not equal, an error is reported.

3.If you wish to have the items that appear in the drop-down list of the combo box in Authentic View sorted, check the Sort Values in Authentic check box.
4.Click OK to finish.

 

Note

Using an XPath expression to select the items of the combo box drop-down list enables you to create combo boxes with dynamic entries from the XML file itself.

If the items in the drop-down list of the combo box are obtained from schema enumerations, they will be sorted alphabetically by default. If the items are obtained from an XML data file, they will appear in document order by default. If the items are obtained from a DB, the DB schema must be set as the main schema. If items are obtained from a DB that is not the main schema, a template for the DB row targeted by the XPath expression must be included in the design, even if the template must be empty. Additionally, in such cases, make sure that all instances of the targeted row are fetched.

Combo boxes in Text output displayed the selected value.

 

© 2017-2023 Altova GmbH