I currently use the following method to identify the relevant financial period name (which is stored in the ledgerperiod.Commentaries field:
void period()
{
ledgerperiod lperiod;
while select lperiod
where ledgertrans_1.TransDate >= lperiod.PeriodStart
&& ledgertrans_1.TransDate <= lperiod.PeriodEnd
&& lperiod.PeriodCode == 1
{
PeriodNo = lperiod.Commentaries;
break;
}
}
PeriodStart,PeriodEnd,PeriodCode columns in the ledgerPeriod is used to identify the correct record (in this case the relevant financial period). Ledger periods are recorded in the set of date ranges like
PeriodStart= March 1 … PeriodEnd = March 30 …PeriodCode= Normal, … Commentaries = Period 3 (name of period for example )
Now if your transaction “LedgerTrans” recorded in the range of March1 to March 30, then LedgerPeriod will always give you “period 3”. it just simply matches the date of transaction in the ledgerPeriod record.
My Question
I would appreciate it if anyone could confirm how AX works this out. How does AX understand that when looking at the transdate of for example March 1st, that it should return period 3.
I’m very keen on understanding this and if there are any other tables that use this type of logic. As a programmer how would you know AX has this type of logic. Are they books or case studies available describing this? If so I would appreciate feedback on this as well.
Thanks and kind regards,
Tom