ValidTimeStateFieldType Property on Table- AX 2012 R2, R3
What is the use of “ValidTimeStateFieldType” property on table
Date effective data is tracked in a table that has its ValidTimeStateFieldType changed from its default value of None. Also, an index with its ValidTimeStateKey set to Yes must be added on the table. The system automatically adds the fields named ValidFrom and ValidTo to the table, which will be of type date or utcdatetime. The system automatically prevents overlap between the date ranges in these two fields among rows that track the same entity.
How to fetch records from this type of tables
The following code sample returns the records that are effective during 1/1/2001 and Current date:
static void theAxapta_ValidTimeState (Args _args)
{
vendTable vendTable;
TaxRegistration TaxRegistration;
DirPartyLocation DirPartyLocation;
date ToDate = today();
date FromDate = 01\01\2001;
while select validtimestate(fromdate, ToDate) * from TaxRegistration
join DirPartyLocation
where TaxRegistration.DirPartyLocation == DirPartyLocation.RecId
{
select vendTable where vendTable.Party == DirPartyLocation.Party;
info(strfmt(“%1”, VendTable.Name));
}
}
For more details
http://msdn.microsoft.com/en-us/library/gg861781.aspx
White papers
http://www.microsoft.com/download/en/details.aspx?id=20864
-Harry
No comments:
Post a Comment
Thanks