A single instance codeunit is an implementation of the singleton design pattern, an object that can be instantiated only once; all application objects referring to the singleton will reuse the same instance throughout the application.
Typically single instance codeunits are used to store an instance of an external dotNet component that cannot be instantiated twice, such as the Outlook application. Another example of a singleton object is a storage of user settings data, received from an external source.
In this recipe we will use a single instance codeunit to store user configuration read from an XML file. Configuration will include default date range for the Item Profit page used to report profits per item. This page is described in detail in the Simplifying data access with queries recipe.
Create a table in the object designer. The table will be used as temporary data source and won't store anything in the database.
Create tree fields in...