Field groups (DropDown controls)
A field group in table or table extension objects defines the fields to display in a drop-down control on pages that use the table. The DropDown control is used to select a record from a list of records.
In a table object, you define field groups by first adding a fieldgroups
control, and then adding one or more fieldgroup(<Name>; <Field>)
keyword for each group, where:
<Name>
can be eitherDropDown
, for adding fields to the drop-down control, orBrick
to display data as tiles.<Field>
is a comma-separated list of the fields, by name, to include in the group.
Note
A field group can also be used to specify fields that display when list type pages are shown in the tile view. Learn more in Displaying data as tiles.
fieldgroups
{
fieldgroup(DropDown; Field1, Field2)
{
}
fieldgroup(Brick; Field1, Field2)
{
}
}
Note
The fieldgroups
keyword can't be inserted before the key
control.
Important
The syntax for using a DropDown, must be spelled DropDown
with the right capitalization.
In a table extension object, the fieldgroups
control allows you to add more fields to a field group defined for the table object. This can be done by using the addlast(<name>; <field>)
keyword.
Warning
The server removes the duplicates, if multiple extensions attempt to add the same field more than once. A field can only be added to the field group once.
Add fields for a drop-down control
You add a field to include in a drop-down control by using the DropDown
field group name in the keyword.
The following example illustrates how to add the field:
tableextension 50100 CustomerExercise extends Customer
{
fields
{
field(50100; "V02Max"; Decimal) { }
}
fieldgroups
{
addlast(DropDown; V02Max) { }
}
}
Note
If the field you're adding to the DropDown has Visibility = false
on the underlying lookup page, it won't show up in the drop-down.
If we want to add the "Address 2" field to the Ship-to Address DropDown, the following code illustrates the changes needed to add the "Address 2" field to the Ship-To Address DropDown fieldgroup. The underlying lookup page is the Ship-To Address List, where Address 2 has the Visibility
property set to false
.
tableextension 50101 ShipToAddressExercise extends "Ship-to Address"
{
fieldgroups
{
addlast(DropDown; "Address 2"){}
}
}
pageextension 50101 ShipToAddressExercise extends "Ship-to Address"
{
layout
{
modify("Address 2")
{
Visible = true;
}
}
}
Adding new field groups
APPLIES TO: Business Central 2023 release wave 2 (version 23) and later
It's always possible to add fields to the two predefined field groups, DropDown
and Brick
. If they aren't defined on the target table, they are dynamically created and contain only the fields specified in the addlast
controls.
The ordering of the fields is determined by the order in which extensions are loaded by the server, while removing any duplicate fields.
Related information
Debugging in AL
Developing extensions
Microsoft .NET Interoperability from AL