web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Select For update

(0) ShareShare
ReportReport
Posted on by 110

Running this code shows"

Cannot edit a record in Inventory module parameters (InventTableModule).
The record has never been selected.

"

This error

while select * from CopyOfInventTableModule {
ItemId=CopyOfInventTableModule.itemid;
select forUpdate InventTableModule group by InventTableModule.ItemId where InventTableModule.ItemId== ItemId;
ttsBegin;
InventTableModule.Price=CopyOfInventTableModule.Price;
InventTableModule.UnitId=CopyOfInventTableModule.UnitId;
InventTableModule.ModuleType=CopyOfInventTableModule.ModuleType;
InventTableModule.PriceDate=CopyOfInventTableModule.PriceDate;
InventTableModule.PriceQty=CopyOfInventTableModule.PriceQty;
InventTableModule.PriceUnit =CopyOfInventTableModule.PriceUnit;
InventTableModule.update();
ttsCommit;

}

*This post is locked for comments

  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Hi Derik,

    Remove "group by InventTableModule.ItemId" and it should work, if you want to update all records with same itemid use update_recordset msdn.microsoft.com/.../aa674382.aspx

  • Derik Profile Picture
    110 on at

    Thank you, Sukrut but it is showing error

    Cannot edit a record in Inventory module parameters (InventTableModule). Item number: 000026, Sales order.

    The record already exists.

  • Mea_ Profile Picture
    60,286 on at

    You need to check unique indexes on this table and be sure that updating a record you not creating duplicates.

  • Suggested answer
    Andrew Xu Profile Picture
    3,877 on at

    Try this please,

       update_recordset InventTableModule

       setting

       Price=CopyOfInventTableModule.Price,

       UnitId=CopyOfInventTableModule.UnitId,

       PriceDate=CopyOfInventTableModule.PriceDate,

       PriceQty=CopyOfInventTableModule.PriceQty,

       PriceUnit =CopyOfInventTableModule.PriceUnit

       join CopyOfInventTableModule

       where CopyOfInventTableModule.ItemId == InventTableModule.ItemId

       && InventTableModule.ModuleType == CopyOfInventTableModule.ModuleType;

  • Suggested answer
    startax Profile Picture
    1,845 on at

    Hi derik,

    You have to use your select for update in while statement

    Ex.

    while select tableA

    {

         table.selectforupdate(true)

        tableA.field = tableB.field

        tbaleA.update()

    }

    Thanks,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans