Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Converting SQL query to X++

Posted on by 485

Hello,

I don't know X++ but I know a little SQL... I have this query that I need to write in X++ can someone please help.

Query:

SELECT

   INVOICEID

  ,INVOICEACCOUNT

  ,INVOICINGNAME

  ,CUSTSETTLEMENT.DUEDATE

  ,CUSTSETTLEMENT.CREATEDDATETIME

  ,CUSTSETTLEMENT.TRANSDATE

  ,CustSettlement.SETTLEAMOUNTREPORTING  

  ,INVOICEAMOUNT

  ,PAYMENT      

  ,INVOICEAMOUNTMST

 FROM CUSTINVOICEJOUR join CUSTTRANS ON CUSTTRANS.INVOICE=CUSTINVOICEJOUR.INVOICEID AND  CUSTTRANS.AccountNum = CUSTINVOICEJOUR.InvoiceAccount

and CUSTTRANS.TransDate = CUSTINVOICEJOUR.InvoiceDate

and CUSTTRANS.Voucher = CUSTINVOICEJOUR.LedgerVoucher

join CUSTSETTLEMENT

on CUSTSETTLEMENT.TransCompany = CUSTTRANS.dataAreaId

and CUSTSETTLEMENT.TransRecId = CUSTTRANS.RecId

and CUSTSETTLEMENT.AccountNum = CUSTTRANS.AccountNum

WHERE CUSTSETTLEMENT.DUEDATE = CUSTINVOICEJOUR.DUEDATE

AND CUSTSETTLEMENT.DUEDATE between'2018-09-01' AND '2019-08-31'

AND CUSTSETTLEMENT.TRANSDATE <'2019-08-31 0:0:0'

AND CUSTINVOICEJOUR.INVOICEID LIKE 'ACP%'

AND CUSTINVOICEJOUR.INVOICEACCOUNT='XXXXXX'

*This post is locked for comments

  • Imran Ali Memon Profile Picture
    Imran Ali Memon 55 on at
    RE: Converting SQL query to X++

    change the label of fields on forms

  • Lionel07 Profile Picture
    Lionel07 485 on at
    RE: Converting SQL query to X++

    Hey Imran, thanks much for your help.. the query worked perfectly. I have one problem though,

    When designed my form I need to change the field labels. like due date should say: "From Date" and To date. how can I do that? see image with the issue.

    change-labels-on-form.png

  • Verified answer
    Imran Ali Memon Profile Picture
    Imran Ali Memon 55 on at
    RE: Converting SQL query to X++

    while select * from FROM CUSTINVOICEJOUR

    join CUSTTRANS where CUSTTRANS.INVOICE== CUSTINVOICEJOUR.INVOICEID

    && CUSTTRANS.AccountNum == CUSTINVOICEJOUR.InvoiceAccount

    && CUSTTRANS.TransDate == CUSTINVOICEJOUR.InvoiceDate

    && CUSTTRANS.Voucher = CUSTINVOICEJOUR.LedgerVoucher

    join CUSTSETTLEMENT

    where CUSTSETTLEMENT.TransCompany == CUSTTRANS.dataAreaId

    && CUSTSETTLEMENT.TransRecId == CUSTTRANS.RecId

    && CUSTSETTLEMENT.AccountNum == CUSTTRANS.AccountNum

    && CUSTSETTLEMENT.DUEDATE == CUSTINVOICEJOUR.DUEDATE

    && CUSTSETTLEMENT.DUEDATE >='20180901'

    && CUSTSETTLEMENT.DUEDATE <='20190831'

    && CUSTSETTLEMENT.TRANSDATE <'20190831'

    && CUSTINVOICEJOUR.INVOICEID LIKE 'ACP*'

    && CUSTINVOICEJOUR.INVOICEACCOUNT=='XXXXXX'

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

Featured topics

Product updates

Dynamics 365 release plans