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)

Customer Addresses - How to join the tables?

(0) ShareShare
ReportReport
Posted on by

Hello,

I recently upgraded from 4.0 to AX2012 and I'm trying to build a simple report in Crystal to show Customer Account, Name, Address, but I'm struggling with table joins and hope someone would be kind enough to steer me in the right direction.

I am joining CustTable to DirPartyTable by fields (PARTY > RECID)

DirPartyTable to LogisticsLocation  (PRIMARYADDRESSLOCATION > RECID)

LogisticsLocation to LogisticsPostalAddress (RECID > LOCATION)

...but I'm getting double records - I have tried all kinds of different join types but the results are the same.
Are my joins even correct?  I would really appreciate any direction on this.

Thank you!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    LaneSwenka Profile Picture
    361 on at

    Hi Drumcode,

    You may find it more straightforward to use the Views that are provided by Microsoft:

    CustTable.Party -> DirPartyLocationPrimaryView.Party
    DirPartyLocationPrimaryView.Location -> LogisticsPostalAddressView.Location

    You will always want to add a where-clause for dataAreaId to limit by company the customer is released, in case you are using the party system to link the same account across multiple legal entities.

  • Suggested answer
    Bilal Issa Profile Picture
    4,370 on at

    Hi ,

    you missed one table only DirPartyLocation , so DirPartyTable to DirPartyLocation  (RecId ,Party), then DirPartyLocation to   LogisticsLocation  (location,recid)

    Regards,

    Bilal

  • Community Member Profile Picture
    on at

    Ok, I've used your suggestion and something still isn't correct. I am expecting to see 2077 records, but instead Crystal spits out 2174, but that's only after I added the street field from LogisticsPostalAddressView. If Custtable.AccountNum and DirPartyTable.Name fields are on the report, the total number of records is just fine. I've tried all types of link types, the number of records stays the same. Do I have to provide anything else in the selection criteria besides the DATAAREAID? We're only one entity btw.

  • Community Member Profile Picture
    on at

  • LaneSwenka Profile Picture
    361 on at

    Can you send us your updated query?  

    Another thing to be aware of is that LogisticsPostalAddress, and the related View are ValidTimeState based.  

    Perhaps add another where-clause with the following:

    where (getdate() BETWEEN addressView.ValidFrom AND addressView.ValidTo)

  • Suggested answer
    Community Member Profile Picture
    on at

    Check the following blogpost for fetching addresses of Customer, Vendor etc by address type.

    thinkinginax.blogspot.com/.../getting-address-by-type.html

    Hope this helps you

  • Community Member Profile Picture
    on at

    I went with using the views. Afnan, I'd love to find out how to join tables per your suggestions, but I'm not all that good with reading X++. Thanks for the input though.

    I absolutely hate how MS complicated the whole address structure in 2012, hate it.

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

#2
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

#2
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans