Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

getting year from Accounting Date

Posted on by 2,016

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
    Martin Dráb 230,188 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans