Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Replacement Key - Alternate

Posted on by 487

HI All,

I have a table in AX 2012 and it is just designed to store some data and not used anywhere in AX(i found the AOT and no reference of this table aywhere). Just a report is pulled from this table.

The fields in this table(TEST) are item  type,item group,replace date, qty.

The table pk,clustered index is Surrogate Key and replacement index is (new index created on table with fields type,group and replace date which is als marked as Alternate key=Yes)

Problem is- when 2 different users(user id different) creates same record(item was replaced on same date) the system throws error that record already exist.

User A-TYpe(A). Group(N),Replace date-today, qty-1

UserB-Type(A),Group(N),Replace date-today, qty-1

I tried adding a new field as " Created by(properties of table-created by -Yes) in index. It allowed me to save the record with different user id. But when i was trying to add the field in index(created by) it gave me warning that adding field in key will affect the records)

Need to know if any implications will be there if i add  "Created by" in the table index.

Also dont know why replacement key is marked as  "Alternate key" by previous developers(new to AX)

Kindly reply.

*This post is locked for comments

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,269 Super User 2024 Season 2 on at
    RE: Replacement Key - Alternate

    You should not change the surrogate key (primary in this case) as it is a record ID which is not causing your duplicate issue. The replacement key with the fields type,group and replace date is probably set to not allow duplicates. In that case, you can extend this replacement key with the created by column.

  • NDingankar22 Profile Picture
    NDingankar22 487 on at
    RE: Replacement Key - Alternate

    Dear Andre,

    Greetings

    Many thanks for the reply.

    It is customized table and only a report is generated(with sum of qty on that date)

    Will it be ok if I add the "Created BY" in the replacement key or will have any other implications.

    Regards

    N

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,269 Super User 2024 Season 2 on at
    RE: Replacement Key-Alternate-AX 2012

    Hi NDingankar22,

    Can you tell if this is a standard or custom table? Usually when tables are used for reporting purposes, they are set to be temporary. In that scenario, each user will have an own specific instance and the data which is used on the report is then deleted automatically.

    There are certain reports which do have persistent tables. In that case, you indeed have to manage the correct split in users. The index warning will not block you now as you are adding a field in the index. When you are removing fields from an index which is not allowing duplicates, then there could be an issue.

    To be able to answer the second question, more details needs to be provided. Then it is still guessing, Can you ask the previous developers? If not try to find the documentation online and read about the theory on alternate keys.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans