Skip to main content

Notifications

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

First Only on the datasource

(0) ShareShare
ReportReport
Posted on by 527
What is the easiest route to get the top 1 record from WHSLoadTable to populate the loadid and loadreferenceNum from the createdate.  I'm unfortunately getting multiple lines since there are many load lines tied to the per WHSLoadLine
 
 
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    First Only on the datasource
    Hi Keith,
     
    As Martin mentioned the functionality you are asking is achievable via code, but you cannot do the same at form level.
    Like you can use order by RecId desc to get the most recent records from the table in the select statements.
     
    Thanks,
    Girish S.
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,868 Most Valuable Professional on at
    First Only on the datasource
    There is no way to say that you want to join just a first line in a group, based on some sorting. You'll need a different design.
     
    I would create a view with PurchLine as the data source. It would contain InventTransId and a computed column returning TOP 1 LoadId for the given InventTransId (sorted by CreatedDateTime and with a filter on InventTransType). In the form, I'd join the view with PurchLine and then WHSLoadTable with the view, to get LoadReferenceNum.
     
    I showed this approach in Join first line in AX 2012. Just please note that the code there for the computed column is just for simple demonstration (e.g. it doesn't deal with DataAreaId).

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans