Microsoft Dynamics AX 2012:DateEffective Framework Part1:Create DateEffective/ValidTimeState Table

Hi,All

I will be covering the Date Effective Framework that has come with the newer version of Ax i.e. Ax2012.I have broken the the artifacts of the framework in four parts.

Here is the list:

  1. Create DateEffective table
  2. Create DateEffective Form
  3. Examples of DateEffective records(CreateNewTimePeriod,Correction and Effective Based mode)
  4. How to Query DateEffective records

In this part, I will be creating the DateEffective table

So let start with the introduction

What is DateEffective Framework?

Think of a scenario where company wants to keep track of things like if the company maintains the employee position over the years ,or a government wants to keep track of the Oil prices or want to keep track of Currency values over the period of time so it means the items like oil,currency or employee position should be date effective.In Ax 2012 to provide this functionality for the users ‘DateEffective Framework’ comes in.Microsoft Dynamics AX 2012 offers the date effective functionality to provide the ease, consistency, and scalable behavior of application code for date effective scenarios.

Now I am quickly jumping to the creation of  DateEffective table

Creation of DateEffective table or Valid Time State table

Here i am covering the scenario of Currency to be date effective

I have created a new table with the name ‘AsimDateEffectiveTable’ with the fields

  • Currency of type string
  • Price of type integer

table1

Now to make it DateEffective/ValidTimeState table i need to set the ‘ValidTimeStateFieldType’ property like

ValidTimeStateField

So i have selected the Date option just to make things simple,after saving the table and error comes in

Error

So the error saying is,the table should have a unique index to be a date effective table,so here is the solution

Idx

I have created an Index with the name CurrencyIdx containing fields Currency ,validFrom,validTo.

Reason for the Idx fields

  • Currency field is our mandatory field
  • ValidFrom should be use to make the idx unique.So the combination of Currency and ValidFrom makes a unique record.
  • ValidTo  may be or may not be use,but it is a best practice to use it on creating new tables

set properties of the index to :

IdxProperty

Here i have set:

  • AllowDuplicates = No
  • AlternateKey = Yes
  • ValidTimeStateKey = Yes
  • ValidTimeStateMode = NoGap(so there will be no gap between versions of the same record)

So on compiling the table the error would be gone .Now the table as a unique index

Last thing we would be doing is to placing this index as a replacement key of a table like :

ReplacmentKey

Now just save the table and we have created our dateEffective/ValidTimeState Table we would be something like this

table

I have added some data records here.

Please let me know for queries

Advertisements

One response to “Microsoft Dynamics AX 2012:DateEffective Framework Part1:Create DateEffective/ValidTimeState Table

  1. Pingback: Microsoft Dynamics AX 2012:DateEffective Framework Part 2:Create DateEffective Form « amazingAX·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s