web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Dynamics AX 2012 Advanced filter with sql statement; outer join

(0) ShareShare
ReportReport
Posted on by

I would like to use the advanced filtering function to find records that has no transactions in another table. Example; filter transactions in SalesAgreementHeader that is not yet confirmed. This means that there is no transaction in the SalesAgreementHeaderHistory. I found below sql example to find transactions in the CustTable even if there is no match in SalesTable.

 SELECT * FROM CUSTTABLE

       OUTER JOIN SALESTABLE ON SALESTABLE.CUSTACCOUNT = CUSTTABLE.ACCOUNTNUM

       AND SALESTABLE.CURRENCYCODE = 'EUR'

First i wonder what the syntax is to enter this in the advanced filter function; if it is possible at all. Secondly what must I add to ONLY find the transactions that have no match in the SalesAgreementHeaderHistory table (or SalesTable with the above example given).

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    on at

    you must use the not exists join as in the example shown.

    while select AccountNum, Name from custTable

       order by AccountNum

       notExists join * from ctr

       where (ctr.AccountNum ==

           custTable.AccountNum)

    Refer here for more sql syntax

    msdn.microsoft.com/.../aa656402.aspx

  • Community Member Profile Picture
    on at

    Thanks but how would the example look in the advanced filter function? I would like to, as a normal user, enter and save the filter to find transactions with no transactions in the "sister" table.

    BR

  • guk1964 Profile Picture
    10,888 on at

    Enter the query as an SQL statement between parenthesis.

    For example, (datasource.Fieldname!= "A")  

  • dolee Profile Picture
    11,279 on at

    I tried "EXISTS" and "IN", both didn't work for me. (But you might want to give it a try anyway in case the problem was on my side. )

    Cheers

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans