The Table as a class
Before we start coding, we need to find the owner of a process. If we explicitly connect the process to the owner, it will be easier for everyone who works with the object to understand what it can do.
Let's try to clarify this with an example. One of the processes that has a lot of owners in Microsoft Dynamics NAV is printing an address. We can print addresses for customers, vendors, documents, and more. In Chapter 2, Design Patterns, we have learned the Pattern to use and print addresses.
If we want to print a customer address on a report, we have to perform the following steps:
- First, create a report that uses the Customer as a
dataitem
. - Then, declare a global text variable called
Addr
with a length of50
characters, and an array length of8
characters. - Then, we declare Codeunit 365 as a variable.
- Finally, we call
FormatAddress.Customer(Addr, Customer)
.
The following screenshot shows the Report Designer window:
This will return a populated address array...