![]() |
#1 |
Участник
|
The Reusable Dynamics NAV Patterns is a joint initiative between the NAV team NAV partners. This is an open initiative to anyone who has documented design patterns which are specific to NAV, please reach back to us either by leaving a comment here, or by writing to us. This said, it's almost weekend, so here you have the NAV design pattern of the week.
Single-Record (Setup) Table Meet the Pattern This pattern is intended for storing information about the operating setup or environment in the database, in a way that can be persisted across sessions. To facilitate this, this information is stored in a table with one record only. The user is subsequently able to modify, but not add or delete records in the table. The most common implementation of this is in the NAV Setup tables. Use the Pattern Implementation of the pattern involves 3 considerations:
Since this kind of tables is a collection of several environment or setup parameters, the primary key does not refer to any business attributes for this kind of tables. However, for maintaining the integrity of the database, it is necessary to define a primary key. So, the most common implementation is to have a field "Primary Key" of Code[10]. This is populated with a blank value when the record is inserted. This field is not added to the page, so that the user cannot be modify it later. Creating a Page The CardPage type is most suitable for representing this kind of tables. In addition, the InsertAllowed and DeleteAllowed properties in the page should be set to false to prevent the user from adding or deleting records in the table. In the OnOpenPage trigger, the following code should be added to insert a record when the user opens the page for the first time, if a record does not exist already. ![]() ![]() Company-Initialize Codeunit The Company-Initialize codeunit (codeunit 2) is executed when a new company is created. We recommended that you add records to the single-record tables in this codeunit. If some of the fields are expected to have default values, they can also be populated here. NAV Usages Several Setup tables in NAV implement this pattern. Some of those are:
Best regards The Reusable Dynamics NAV Patterns team Источник: http://feedproxy.google.com/~r/Micro...tup-table.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|