Skip to main content

Notifications

Announcements

No record found.

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

Why do Microsoft goes with sql statements instead of using x++ select statements

(3) ShareShare
ReportReport
Posted on by 105
Hi experts, 
I came across a method in LedgerJournalTable (Table object) under the method numOfVouchers(). This can be achieved through x++ statements as well. But I just want to understand why Microsoft went with sql statement instead of using X++ statements here. This method is used in posting a journal to check whether there are any journal lines there are to be posted. Any inputs is appreciated. 
 
Regards, 
John
Categories:
  • Layan Jwei Profile Picture
    Layan Jwei 7,484 Super User 2024 Season 2 on at
    Why do Microsoft goes with sql statements instead of using x++ select statements
    Hi,

    it would be great if u can share the code of the method, because not all of us have access to our devBoxes when looking at questions:

    But in general based on Mohamed's comment about distinct, then we can still sometimes achieve sth similar to distinct using group by

    for example these two sentences below give the same result
     
    select distinct AccountNum  from custTable
    select AccountNum from custTable group by AccountNum
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 12,139 Super User 2024 Season 2 on at
    Why do Microsoft goes with sql statements instead of using x++ select statements
     
    because in X++ select statement there's no such thing as a distinct keyword, which is why they use sql statement.
     
    Best regards,
    Mohamed Amine MAHMOUDI

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Share Your Event with the Community

Jump start your event engagement! 📢

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,646 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans