DALThe Data Access Layer (DAL) allows developers to describe rules about data. A DAL is linked to a table, not a session. Therefore, when the table is accessed, the DAL is used. In this way, different sessions can update a table by using the same rules. In addition, integration capabilities use the DAL to ensure updates are also processed with the same rules. Data Access Layer (DAL) scripts implement the business rules of the application to ensure the logical integrity of the database. DAL scripts are a Library software component that is aligned with a specific table. These scripts are compiled into objects. When a session performs an action on a table, the DAL for the table is loaded. In Infor LN, two types of Data Access Layer scripts exist: DAL 1 and DAL 2. Business Rules A business rule is a statement that defines or constrains some aspect or operation of the business. It is intended to control or influence the behavior of the business operations. Business rules are logical integrity rules, and differ from database oriented referential integrity rules. Business Rules - example Business rules in a purchasing system may be:
Referential Integrity Rules - example In contrast, integrity rules in a purchasing system may be:
Business rules are implemented as hooks. A hook is a pre-defined function name that you create in a Data Access Layer script. The 4GL engine will call this function as it executes user interface and database related actions on the table that the DAL is written for. Business rules fall into categories that determine how the business rule is implemented in the DAL. The categories, depending on the type of DAL script, are:
DAL 1 DAL 1 scripts were introduced in Infor Baan 5.0.0. A DAL 1 script contains database logic (e.g. logical integrity rules), but it usually does not contain all business logic for the table it belongs to. Very often business logic is spread across the DAL 1 script and the UI scripts. Most UI scripts still contain business logic. They can contain, for example, logic to:
Therefore it is very hard to use the DAL 1 scripts for integrations via Infor LN Business Adapter: the business logic in the UI scripts is skipped if another application connects to a Infor LN table. Therefore this logic must be rebuilt in the BOIs that provide the connection. If you change the business logic in the UI scripts, you must adapt the corresponding BOIs as well. A DAL 1 script can contain the following types of hooks:
For details on DAL 1 scripts, refer to "Data Access Layer" in the Infor ES Programmer's Guide. To create DAL 1 scripts You can create and edit DAL 1 scripts in the Program Scripts / Libraries (ttadv2530m000) session. For DAL 1 scripts, the script type is "DAL". DAL 2 DAL 2 scripts are introduced in Infor LN. A DAL 2 script contains all business logic (database logic + other logic) related to a particular table. The UI scripts of the sessions operating on the table, only contain UI logic. DAL 2 scripts are therefore perfectly suited for integrations via Infor LN Business Adapter. Other applications can connect, through Business Objects, to Infor LN tables. The business logic in the table's DAL 2 script is executed automatically. So, to build an integration, you don't need to rebuild this business logic in the BOIs that provide the interface. Various predefined Business Objects, that can be used for integration purposes, are delivered with Infor LN. DAL 2 scripts are only available for tables that are used in these business objects. For the remaining tables, DAL 1 scripts are available. Refer to the Infor LN Business Adapter documentation for details on business objects and integration technology. In DAL 2 various new hooks are introduced. A DAL 2 script can contain:
For details on DAL 2 scripts, refer to "DAL 2 Overview" in the Infor ES Programmer's Guide. To create DAL 2 scripts You can create and edit DAL 2 scripts in the Program Scripts / Libraries (ttadv2530m000) session. For DAL 2 scripts, the script type is "DAL (version 2)". Field dependencies In DAL 2 scripts, you can define field dependencies that are used to determine default values. Once these field dependencies are defined, dependent fields update themselves when the fields that they depend on are updated. The field updates are defined in the DAL as a field hook. Dependencies are also used to update the User Interface. The 4GL Engine uses these field dependencies to disable and enable fields, and to determine enum values. Examples of field dependencies are:
Business methods Business Methods are operations on a row or set or rows within a table. A business method is a function that performs a task that involves manipulating or checking one or more tables in the database. Sessions, object hooks or property hooks from another table’s DAL can call a business method. For more information, refer to the Infor ES Programmer's Guide. Examples of business methods are:
| |||