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)

AX Dev101 ? Relationships between tables

(0) ShareShare
ReportReport
Posted on by

Hello all,

This is my Dev 101 question of the day.

I'm creating new tables in AX. I want to create 3 tables. Using my Cyborg theme for creating functionality to start tracking Cyborg Repairs. Here are the table definitions.

CyborgTypeTable - A setup table listing types. Contains 2 fields. A CyborgTypeID field which will be the index, and a Name field for a description.

CyborgClassTable - A setup table listing classes of cyborgs. Contains 4 fields. A ClassID field which will be the index, a CyborgName field for a description, a Version field, and a Type field which will relate back to the CyborgTypeTable as a normal relation with the intention of allowing the user to select via a drop down list the type from the CyborgTypeID field.

CyborgCustomerTable - a table to record Cyborgs being serviced in my fictional company. This table will have 4 fields. A CyborgCustID field which will be the table index, CustAccount which will be the customer account EDT, the CyborgClassID which be a normal relation with the intention of allowing the user to select via a drop down list the ClassID, and finally a CyborgTypeID field which I would like to populate from the relationship of the CyborgClassID record without the user selecting anything.

What would be the proper way to set up the relationships between the tables?

Are there any patterns such as this in AX I can reference?

 

Relation1 from the CyborgClassTable as a Normal Relation CyborgClassTable.CyborgTypeID == CyborgTypeTable.CyborgTypeID

Relation2 from the CyborgCustomerTable as a Normal Relation CyborgCustomerTable.CyborgClassID == CyborgClassTable.CyborgClassID

Relation3 from the CyborgCustomerTable. Would this be a Foreign Key relation > PrimaryKeybased?

 


Thanks in advance for your responses.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: AX Dev101 ? Relationships between tables

    Thanks Martin. I'm going to follow your advice and see how it goes. I appreciate the feedback it helps in learning this new environment!

  • Verified answer
    Martin Dráb Profile Picture
    235,961 Most Valuable Professional on at
    RE: AX Dev101 ? Relationships between tables

    In AX 2012, the first choice should be using surrogate keys. Your own IDs (such as CyborgTypeID), if they're needed at all, would likely be used as natural replacements keys.

    Regardless whether you use surrogate keys or you set your IDs as primary keys, you should use foreign key relations.

    Putting CyborgTypeID to CyborgCustomerTable violates database normalization, because it's a property of cyborg class and not of the customer. You already have it in CyborgClassTable; duplicate it only if you have a good reason for it and don't forget to add code to keep the duplicate value synchronized with the definition in CyborgClassTable.

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
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans