Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

getting year from Accounting Date

(0) ShareShare
ReportReport
Posted on by 2,050

Greeting everyone 

i'm trying to get year and comparing 

select sum(TransactionCurrencyAmount) from generalJournalAccountEntry2 where generalJournalAccountEntry2.MainAccount==MainAccount::findByMainAccountId(_mainAccount).RecId
        join generalJournalEntry where generalJournalEntry.RecId == generalJournalAccountEntry2.generalJournalEntry
        && year(generalJournalEntry.AccountingDate) ==year(fromDate)
        join ledger where ledger.RecId==generalJournalEntry.Ledger && ledger.Name==companyListIterator2.value()
        join fiscalCalendarPeriod where fiscalCalendarPeriod.RecId == generalJournalEntry.FiscalCalendarPeriod
        && fiscalCalendarPeriod.Type==FiscalPeriodType::Opening;

pastedimage1643290394351v2.png

how can i solve that?!

  • Suggested answer
    Martin Dráb Profile Picture
    234,044 Most Valuable Professional on at
    RE: getting year from Accounting Date

    I would get dates for the beginning and the end of the year and compare the date with them. For example:

    int year = year(fromDate);
    
    select ...
    	&& generalJournalEntry.AccountingDate >= mkDate(1, 1, year)
    	&& generalJournalEntry.AccountingDate < mkDate(1, 1, year   1)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 601 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 416

#3
Adis Profile Picture

Adis 384 Super User 2025 Season 1

Product updates

Dynamics 365 release plans