Field selection menus can be opened at the active field by the user and are used to accept text entries. When the field is entered with the write-cursor, an arrow-button for this function will appear at the field. A field selection menu is represented as a choice box.
They are installed by linking a menu with a mask field. To do so, you enter the menu name in the Mask Field relation, field Menu. Additionally you have to selet the Menu-Type C (choice box). For the link is established in the mask-field relation, the field can be linked with another selection tool when used in other masks.
If the defined maximum menu length in the manu master is smaller than the number of items in the menu, the choice box will get a scroll bar.
Note! Any field selection tools of the types M (menu) or L (list box) defined prior to version 4.1 will automatically be displayed as choice box. The ld entries M and L in the Menu Type field will remain unchanged. However, they are not supported as new entries any longer.
Items in field selection menus usually only have to provide item texts to be imported into the field. For this reason you do not have to enter any function calls in the userexit field of the item master for these items. The DataView default functionality automatically takes a selected item text into the field. Basically there are two methods to create item texts for field selection menus:
Each item text in the selection menu requires the creation of an own item object. When creating records you should only specify the text attribute in addition to the required item name. Make sure that the text entries correspond to type and length of the field which you assign the selection menu to.
Item texts for a selection menu can be directly read from the columns of a database table. In this case each record of the table creates an item object with item text. The database table and the column are referred to by a corresponding control selection. This procedure is only useful for field selection menus, because for the automatically created items only the item text and not the function call can be read from the table.
Create a control selection in the selection menu and enter the macro @TABLENAME.COLUMN1,COLUMN2,... into the field Text. As a rule you will only address one table column. If you specify several columns (separated by commas), the item text is composed of the entries of all specified columns separated by |. The selection menu will have the resulting width. When such a multi-column item text is selected to take it into a field, only the first column entry will be inserted. You should always make sure that the type and the length of the only table column or the one addressed first correspond to the type and the length of the field the selection menu is assigned to.
Using an additional search query you can make sure that not each record of the table addressed is used to generate an item object. Pass a search term (Where condition) to the macro @TABLENAME.COLUMN1,COLUMN2,... in the Parameter field. Operators and special characters for search terms correspond to those of the default function Search (cf. -> Search Requests in the Search Line). The query is only performed in Column1. Entries that do not correspond to the search criterion are not used to create items. If you use the control selection in several selection menus, you can define different menu-specific search terms.
User-specific access rights within the addressed table can be transferred to the field selection menu with the help of the default variable DISPNOACCSEL.
If during a session the data of the addressed table change, you can update a resulting selection menu by deleting it from main memory with the API function men_del_men (e.g. at the Post_Field trigger). At opening the menu will be newly loaded into main memory and, thus, be updated.
And eventually from a selection menu is accepted into a field by selecting plus mouse click or via [Enter].
If you want to allow only the entries offered in the selection menu as valid field contents, you can install the userexit cch_chk_men at the Post-Field trigger. The checking is done only in Insert and Update mode of mask edit state. If the userexit is not installed, the user can enter any string in addition to the entries in the selection menu.
Attention! The special characters ">" and "|" in the selection text are interpreted as end-of-string characters by DataView. When a selection text is taken into the field, the userexit cch_chk_men will only check the text up to the end-of-string character. These special characters can be masked by "\>" or "\|", respectively. The userexit will then also check selection texts containing special characters.
In Query mode of Mask-Edit state users can accept query terms from the selection menu. In contrast to the Insert an Update modes any existing entry will not be replaced when another one is accepted, but appended and combined by "|" (OR). Because the Post_Field trigger does not work in Query mode, such a combined query term will also be accepted if cch_chk_men it installed.
At selection menus in the field userexits, you can call your own functions, e.g. to check text entries before taking them over, modify, or replace them in the field. The return value of their functions determines the next behavior:
Calls of sub-menus for selection texts in choice boxers with @NEXT result in a cascading. DataView will automatically insert the selection texts of the sub-menu under the superordinate selection text. The superordinate selection text will be greyed and is not selectable.