Search This Blog

Wednesday 9 July 2014

Valid Time State Tables in Dynamics AX 2012 [ValidTimeStateFieldType]


Hi Guys,

In DAX 2012, we can let the system manage data relationships that are valid only during a specified date range.
This can be achieved by setting “ValidTimeStateFieldType” property on the table.The system then adds the ValidFrom and ValidTo columns that track a date range in each row. The system guarantees that the values in these date fields remain valid by preventing overlap among date ranges, based on the primary key value.
Let me explain with an example. Let us create a new table with a new string field “Name” which extends Name EDT.
Right click on the table and set the ValidTimeStateFieldType property to utcdateTime as shown below

After setting this property, system will automatically create ValidFrom and ValidTo fields in your table as shown below

Create a new Index by name NameIdx and drag drop Name, ValidFrom, ValidTo fields on to the index and set the following properties on your newly created index as shown below.

You can set the NameIdx as replacement Key on the table.
Now open the table and start entering the data. you will notice that ValidTo will be automatically defaulted to maxdate() 12/31/2154[Never] and validFrom to system date and time now as shown below.



Happy Daxing....

No comments:

Post a Comment