Multi-Level Setup

When designing software for both small-sized and medium-sized businesses, there is often a balancing act in the designing setup options. Where some companies only require a feature to be turned on or off, other businesses require them to be more flexible.

In order to allow the best of both worlds, we can simply add the setup options to both the tables, and write a small interface to read the values based on importance.

Technical description

The setup fields need to be implemented on at least two levels, for example, a Singleton and Supplemental table. The setup options should be identical.

To read the setup values, we need to provide a function that first checks the most detailed level, the Supplemental table, and then the Singleton table.

Technical description

The following code snippet is a part of Codeunit 11 Gen. Jnl.-Check Line, and checks the values of Allow Posting From and Allow Posting To in reference to a PostingDate variable:

DateNotAllowed(PostingDate : Date) : Boolean
IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN
  IF USERID <> '' THEN
    IF UserSetup.GET(USERID) THEN BEGIN
      AllowPostingFrom := UserSetup."Allow Posting From";
      AllowPostingTo := UserSetup."Allow Posting To";
    END;
  IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN
    GLSetup.GET;
    AllowPostingFrom := GLSetup."Allow Posting From";
    AllowPostingTo := GLSetup."Allow Posting To";
  END;
  IF AllowPostingTo = 0D THEN
    AllowPostingTo := 31129999D;
END;
EXIT((PostingDate < AllowPostingFrom) OR
  (PostingDate > AllowPostingTo));

Implementations

This feature can be implemented across the application where it is required.

Examples

These objects contain examples of the following Pattern:

Field Name

Type

Table

Description

Allow Posting From

Date

98

The General Ledger Setup

Allow Posting To

Date

98

The General Ledger Setup

Allow Posting From

Date

91

The User Setup

Allow Posting To

Date

91

The User Setup

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

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