Field Groups
When a user starts to enter data in a field where the choices are constrained to existing data (for example, an Item No., a Salesperson Code, a Unit of Measure code, a Customer No., and so on), good design dictates that the system will help the user by displaying the unperse of acceptable choices. Put simply, a lookup list of choices should be displayed.
In the Role Tailored Client (RTC), the lookup display (a drop-down control) is generated dynamically when its display is requested by the user's effort to enter data in a field that references a table through the TableRelation property (which will be discussed in more detail in the next chapter). The format of the dropdown is a basic list. The fields that are included in that list and their left to right display sequence are either defined by default, or by an entry in the Field Groups table.
The Field Groups table is part of the NAV table definition much like the list of Keys. In fact, the Field Groups table is accessed very similar to the Keys, navigating through View | Field Groups, as shown in the following screenshot:
If we look at the Field Groups for Table 27 - Item, we see the drop-down information defined in a field group, which must be named DropDown (without a hyphen):
The drop-down display created by this particular field group is shown in the following screenshot on the Sales Order page containing fields in the same order of appearance as in the field group definition:
If no field group is defined for a table, the system defaults to using the primary key plus the Description field (or Name field).
Since Field Groups can be modified, they provide another opportunity to tailor the user interface. As we can see in the preceding screenshot, the standard structure for the fields in a field group is to have the primary key appear first. The user can choose any of the displayed fields to be the default filter column, the de facto lookup field.
As a system option, the drop-down control provides a find-as-you-type capability, where the set of displayed choices filters and re-displays dynamically as the user types, character by character. The filter applies to the default filter column. Whatever field is used for the lookup, the referential field defined in the page determines what data field contents are copied into the target table. In the preceding screenshot, the reference table/field is the Sales Line table/field No. and the target table/field is the Item table/field No.
As developers, we can change the order of appearance of the fields in the drop-down display. We can also add or delete fields for the display by changing the contents of the field group. For example, we could add a capability to our page that provides an alternate search capability (where if the match for an Item No. isn't found in the No. field, the system will look for a match based on another field).
Consider this situation: the customer has a system design where the Item No. contains a hard to remember, sequentially assigned code to uniquely identify each item. But the Search Description field contains a product description that is relatpely easy for the users to remember. When the user types, the find-as-you-type feature helps them focus and find the specific Item No. to be entered for the order. In order to support this, we simply need to add the Search Description field to the Field Group for the Item table as the first field in the sequence. The following screenshot shows that change in the Item Field Group Field List:
The effect of this change can be seen in the following screenshot, which shows the revised drop-down control. The user has begun entry in the No. field, but the lookup is focused on the newly added Search Description field. Find-as-you-type filtered the displayed items down to just those that match the data string entered so far (the user entered st , and the field group filtered to items with Search Description starting with ST):
The result of our change allows the user to look up items by their Search Description, rather than by the harder to remember Item No. Obviously, any field in the Item table could have been used, including our custom fields.