The Argument table

The Argument table has an ambiguous place in the categorization of patterns. The table is used to combine fields when we call a function. This can be compared to a class in object-oriented programming. Since Microsoft Dynamics NAV does not allow us to create a class, we use the table object instead. This will automatically create a table in the SQL Server, but this table will never contain any data. However, some tables are used for both arguments and normal data.

In computer programming, the general rule of thumb is to avoid functions that have too many arguments in the signature. When a function has more than three or four arguments, we should combine them into an argument table.

Technical description

The definition of the table should contain all the fields used in the arguments. The primary key of the table is not important, since the table will never contain actual data. However, the metadata in Microsoft Dynamics NAV requires at least one field as the primary key. This can be any field in the argument table, preferably field 1.

The following diagram explains how to implement Argument Pattern:

Technical description

This Argument table is bound to the implementation of the function and should not be reused.

Implementations

Microsoft Dynamics NAV uses the concept of dedicated tables as argument tables for e-mail handling. Also, the Journal Line tables are used as argument tables to create ledger entries during posting.

Note

We will use the Argument table in Chapter 5, Coding Best Practices, to help us organize code and implement the overloading in Microsoft Dynamics NAV.

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

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