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)

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

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: Select For update

    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
    RE: Select For update

    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,284 on at
    RE: Select For update

    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
    RE: Select For update

    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
    RE: Select For update

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans