Model-View ViewModel Pattern

As explained in Chapter 1, Introduction to Patterns and Software Architecture, the Page objects are bound to the Table objects. The way the data is displayed to the user is the way we store it in the SQL Server database.

This is not always what we want. In some cases, we want to display the information in a different, way than how we store it in the database.

For this reason, each Page has the property SourceTableTemporary, and Reports have the Temporary property since Microsoft Dynamics NAV version 2015.

Technical description

The basics for this Pattern is the Temporary Dataset, which is a table that contains the field layout that we want to display to the user. This needs to have a matching Primary key, which is often Rules Pattern or Entry Pattern.

When this is set and we start up the Page or Report, we won't see any data. We need to load it into memory first.

This can be achieved by calling a function in either the OnOpenPage trigger, an Action, or a combination of these. This function should read the data and populate the source table of the Page or Report.

Technical description

Once the Page or Report is closed, the data is deleted from memory.

Implementations

The most well-known implementation of the MVVM pattern in Microsoft Dynamics NAV is the Navigate page object. This has a function called FindRecords.

Examples

These objects contain examples of the following Pattern:

Object ID

Description

Page 344

Navigate

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset