Hi, Readers.
Today I would like to briefly talk about a very basic topic, what is the difference between TableRelation, Enum/Option, Lookup and AssistEdit on the page (UI).
In Dynamics 365 Business Central, pages are the main way to display and organize data. Pages are the primary object that a user will interact with and have a different behavior based on the type of page that you choose.
A page is defined in code as an object composed of controls, properties, actions, and triggers. For example, page 21 “Customer Card”
In editable fields, there are four special behaviors, TableRelation, Enum/Option, Lookup and AssistEdit (Maybe this is not the official name, but I hope you understand). Generally used to create a lookup field on the page that uses data from another table to populate a field in the current table.
Let’s see more details.
TableRelation
The TableRelation
property lets you establish lookups into other tables. For example, on the Item Card you can select a vendor from who you usually purchase an item.
This is done through a table relationship.
The same is true for other fields such as Country/Region Code on the Customer Card and No. on the Sales Order Subform.
On the page (UI), there is a downward arrow on the far right. Clicking it will open a Drop-Down List (Include header). The fields are set in the fieldgroup -> DropDown. If not set, the primary key(s) will be displayed.
2. Dynamics 365 Business Central: How to Customize Drop-Down List (Field Groups)
3. Business Central 2023 wave 2 (BC23): Add a new FieldGroup (Brick & DropDown) to an existing table
Enum/Option
An enumeration type, also known as an enum in programming, is a keyword used to declare a type that consists of a set of named constants. For example, Blocked on the Customer Card:
The Option type is a zero-based enumerator type, which means that the option values are assigned to sequential numbers, starting with 0. It is similar to Enum, but cannot be reused.
On the page (UI), there is a downward arrow on the far right. This is the same as TableRelation, but it only displays values, no header, no multiple columns.
PS:
Dynamics 365 Business Central: Hiding enum values on the page (ValuesAllowed Property)
Lookup
This is the lookup processing set in OnLookup (Page Field) trigger and OnLookup (Field) trigger. For example, Sell-to Customer Name and Sell-to Contact No. on the Sales Order.
And Bill-to Name on the Job Card.
On the page (UI), these fields have a button (three-dot icon) on the far right.
Run the lookup page as a modal page after clicking. (This is the biggest difference from TableRelation. TableRelation is only displayed on the current page, while Lookup will pop up a new page)
Transfer the value the user selects back to the field when the user chooses OK.
AssistEdit
This is similar to Lookup and is also a special behavior. If AssistEdit Property is true, assist-edit capabilities and an AssistEdit button are provided on the page.
Unlike Lookup, this button is not inside the field, but outside.
You can add AL code in the OnAssistEdit Trigger to change the default assist-edit behavior. For example, No. on the Customer Card.
You can use this trigger to write to the database. Or do some query processing like Lookup. We have practiced this in Dynamics 365 Business Central: How to create a universal record selection/lookup page – arbitrary table
That’s all, here is a brief summary:
2. New calendar date picker in Business Central 2024 wave 1 (BC24)
END
Hope this will help.
Thanks for reading.
ZHU
コメント