Chapter 1: X++ Unit Test Framework
Chapter 2: Working with Data
Chapter 3: Classes
Chapter 4: Forms
Chapter 5: Visual Studio Integration
Chapter 6: Workflow
Lesson 5 : Date Effectiveness
Date effectiveness allows the application to associate valid from and to dates with the application artifacts. For example, an agreement can be valid between a range of dates. Similarly, interest rates are assigned based on start date and end date association.
The date effectiveness feature is a central framework that is supported in all framework components. It helps developers write less code, to develop more consistent code, and to create forms that manage viewing and editing of current, past, and future records.
This section describes how to use date effective tables, also known as valid time state tables, to store and track object history in Microsoft Dynamics AX 2012.
- The difference between the two types of valid time state tables
- How valid time state tables are integrated with the security framework
- Various update modes
- How to use the validtimestate keyword in queries
- Runtime behaviors
- Scenarios that are not supported by the framework
If we want to use data effective table in our database design, here are the steps we need to follow in order to make it happen. For a new created table that we want to be a date effective one, first we have to decide about granularity for ValidFrom and ValidTo fields in which will be stored an information about date.
We can choose between Date and UtcDateTime options. Choice depends on our needs. If we want effectiveness of a record at the same UTC time all over the world we are selecting UtcDateTime. If we want record to be effective on a certain date no matter on current location of a customer we are choosing Date.
After this step ValidFrom and ValidTo fields will appear in our table with a type reflecting our choice – Date type for Date and DateTime type for UtcDateTime
Second thing that we have to do is set up an index on the table. In its properties we are setting as you can see in picture below. Before setting ValidTimeStateKey property, put ValidFrom field inside index.