Use and create views in application language
Views in Business Central are used on list pages to define a different view of the data on a given page.
Views can be defined for:
Pages
Page extensions
Page customizations
Views are defined on page extension objects to provide an alternative view of data and/or layout on an existing page. Additionally, views on page customization objects can be used to provide an alternative view for a certain profile.
A view offers the following capabilities:
Filtering on multiple table fields on the source table that is defined for the page
Sorting data on multiple table fields, but only in one direction: ascending or descending
Changing layout, modifying and moving page columns, and so on
Views are defined directly in code on the list page that they modify. The defined view or views are available to the user through the Filter pane on a page and appear in the sequence that they are defined in code.
You can use the tview snippet to create the basic layout for a view.
profile TheBoss
{
Description = 'The Boss';
ProfileDescription = 'This profile is used for the Business Manager.';
RoleCenter = "Business Manager Role Center";
Customizations = MyCustomization;
Enabled = true;
Promoted = true;
Caption = 'Boss';
}
pagecustomization MyCustomization customizes "Customer List"
{
actions
{
moveafter(Orders; "Blanket Orders")
modify(NewSalesBlanketOrder)
{
Visible = false;
}
}
views
{
addfirst
{
view(BalanceLCY)
{
Caption = 'Ordered Balance LCY';
OrderBy = ascending ("Balance (LCY)");
SharedLayout = false;
layout
{
// Change the layout of the view
movefirst(Control1; "Balance (LCY)")
modify(Control1)
{
FreezeColumn = "Balance (LCY)";
}
}
}
}
}
}