Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

New sql view

Posted on by 5

Hi,

I need to create new view in SQL which will show me all vendors with their active account number. Can you help me ?

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: New sql view

    Regarding active bank accounts, I think that you should check ActiveDate and ExpiryDate fields.

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: New sql view

    Hmm, I thought you want to create a view in AX 2012. If so, you should create it in AOT. Meddling with the database directly is difficult and risky. You would need direct access to the database, you would bypass AX security, you couldn't use AX business logic (which is likely your current problem), you would have to manually handle data areas (which is where you've failed already), date-effective tables (another bug) and so on and so on. Please stop that and create a view in AOT.

    By the way, please always paste formatted code via Insert > Insert Code (in the rich-formatting view). For example:

    SELECT DISTINCT * FROM VendTable
    LEFT OUTER JOIN VendBankAccount ON VendBankAccount.VendAccount = VendTable.AccountNum
    --AND  VendBankAccount.AccountId = VendTable.BankAccount
    LEFT OUTER JOIN DirPartyTable ON DirPartyTable.RECID = VendTable.Party
    LEFT OUTER JOIN LogisticsPostalAddress AS Address ON Address.Location = DirPartyTable.PrimaryAddressLocation

    That's much easier to read, isn't it?

  • mwit Profile Picture
    mwit 5 on at
    RE: New sql view

    I'm not sure how to filter only active accounts numbers

    I try something like this:

    SELECT distinct VENDTABLE.ACCOUNTNUM, DIRPARTYTABLE.NAME,Address.ADDRESS ,

    VendBankAccount.ACCOUNTID BankAccount ,VendBankAccount.NAME 'Bank Name' ,VendBankAccount.ACCOUNTNUM 'Bank account number',

    VendBankAccount.RegistrationNum 'Routing Number',VendBankAccount.SWIFTNo,VendBankAccount.BankIBAN

    from VENDTABLE left outer JOIN VendBankAccount ON VendBankAccount.VENDACCOUNT = VENDTABLE.ACCOUNTNUM --AND  VendBankAccount.ACCOUNTID = VENDTABLE.BANKACCOUNT

    left outer join DIRPARTYTABLE ON DIRPARTYTABLE.RECID = VENDTABLE.PARTY

    left outer join LOGISTICSPOSTALADDRESS AS Address ON Address.LOCATION = DIRPARTYTABLE.PRIMARYADDRESSLOCATION

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: New sql view

    Okay, and what's the problem?

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans