In this blog post, we are going to learn how to retrieve data from tables using the date effective framework in AX 2012.
There are three possibilities when retrieving data:
|Current||Getting Carpenter wage that is currently active||Select * from AXPWorkerWagesTable where AXPWorkerWagesTable.WorkerType == “Carpenter”|
|Specific date||Getting Carpenter wage that is active on a specific date. This can be past, present or future depending on the date.||Date targetDate = 12\25\2013;
Select validtimestate (targetDate)* from AXPWorkerWagesTable where AXPWorkerWagesTable.WorkerType == “Carpenter”;
|Range||Getting Carpenter wage that is active within a range.||Date startDate,endDate;
startDate = 12\25\2012;
endDate = 12\25\2013;
while Select validtimestate (startDate,endDate)* from AXPWorkerWagesTable where AXPWorkerWagesTable.WorkerType == “Carpenter”
In our case, I have used a “Date” type as a parameter for validtimestate() method. However, that depends upon whether you are using the Date type for tracking changes or UtcDateTime.
Similarly, to fulfill the same, AX has introduced some new methods in the Query API. Following are the methods that are added, they are pretty self explanatory.
- validTimeStateDateTimeRange(FromDateTime, ToDateTime);
That’s all for now. I hope you enjoyed reading this blog post. Good day!