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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Join first only from joined table

(0) ShareShare
ReportReport
Posted on by 1,450

I'm coming up blank on a way to do this in AX. 

We have a need for the latest internal packing slip ID to be displayed on the VendPackingSlipJournal form. A straight inner join results in multiple records being displayed if there are multiple versions.  A display method is not acceptable to the users as they filter on this field. I have tried every combination of QBDS, Views, and Queries that I can think of.  If I wanted just the internal packing slip ID I could do that easily as well but if we ever need another field from the Version I want that to be available. Maybe I'm just taking the wrong approach? Anyone have any ideas?

I can write it pretty simply in SQL:

SELECT *
FROM VENDPACKINGSLIPJOUR T1
JOIN VENDPACKINGSLIPVERSION T2
ON T2.RECID =
(
    SELECT TOP 1 RECID 
    FROM VENDPACKINGSLIPVERSION T3
    WHERE T3.VENDPACKINGSLIPJOUR = T1.RECID
	ORDER BY T3.VERSIONDATETIME DESC
)
--WHERE T1.PURCHID = 'PO1345678'


*This post is locked for comments

I have the same question (0)
  • Konrad U Profile Picture
    804 on at

    Use the firstonly qualifier maybe?

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    What about computed field msdn.microsoft.com/.../gg845841.aspx that has you select statement behind ?

  • KCDeVoe Profile Picture
    1,450 on at

    "Use the firstonly qualifier maybe?"

    -The kernel drops it as it doesn't translate to SQL.

    "What about computed field msdn.microsoft.com/.../gg845841.aspx that has you select statement behind ?"

    -I thought of using computer columns, but I would have to do one for every column.

  • Verified answer
    KCDeVoe Profile Picture
    1,450 on at

    The solution I went with was an intermediate view. View of VendPackingSlipJournal column and max(InternalPackingSlipId) grouped by VendPackingSlipJournal from VendPackingSlipVersion then joined VendPackingSlipVersion on VendPackingSlipJournal that way.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans