web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Community Member Profile Picture
    on at
    RE: Customer Addresses - How to join the tables?

    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.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Customer Addresses - How to join the tables?

    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

  • LaneSwenka Profile Picture
    361 on at
    RE: Customer Addresses - How to join the tables?

    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)

  • Community Member Profile Picture
    on at
    RE: Customer Addresses - How to join the tables?

  • Community Member Profile Picture
    on at
    RE: Customer Addresses - How to join the tables?

    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.

  • Suggested answer
    Bilal Issa Profile Picture
    4,370 on at
    RE: Customer Addresses - How to join the tables?

    Hi ,

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

    Regards,

    Bilal

  • Verified answer
    LaneSwenka Profile Picture
    361 on at
    RE: Customer Addresses - How to join the tables?

    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.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Guy Terry Profile Picture

Guy Terry 2 Moderator

#1
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#1
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans