# Update\_recordset

**URL:** <https://www.dynamicsuser.net/t/update-recordset/53240>\
**Category:** Developer Forum\
**Created:** [June 10, 2014, 7:20am UTC](https://www.dynamicsuser.net/t/update-recordset/53240 "2014-06-10T07:20:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Kumar\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Abhishek\_Kumar\_Singh](https://www.dynamicsuser.net/u/Abhishek_Kumar_Singh)\
**Post date:** [June 10, 2014, 7:20am UTC](https://www.dynamicsuser.net/t/update-recordset/53240/1 "2014-06-10T07:20:44Z")

</div>

Hi All,

I am trying to use update\_recordset to update the records of my table but even then it’s very slow. I have also overridden and have some logic added in the update method of my table. Is this the reason why it is slow?

Any other way to increase the performance.

Regards,

Abhishek

---

<div class="post-metadata">

**Author:** ![DevAX](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@DevAX](https://www.dynamicsuser.net/u/DevAX)\
**Post date:** [June 10, 2014, 7:33am UTC](https://www.dynamicsuser.net/t/update-recordset/53240/2 "2014-06-10T07:33:19Z")

</div>

Hi abhishek,

If you have overridden and have some logic added in the table update method, then in this case Update\_recordset falls back to a classic looping construction, updating records one by one just as the normal table.update() is done. So in this as usual it will fetch and update records one by one.

I hope i cleared your query to some extent.

Thanks  
Nitish

---

<div class="post-metadata">

**Author:** ![Abhishek\_Kumar\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Abhishek\_Kumar\_Singh](https://www.dynamicsuser.net/u/Abhishek_Kumar_Singh)\
**Post date:** [June 10, 2014, 7:37am UTC](https://www.dynamicsuser.net/t/update-recordset/53240/3 "2014-06-10T07:37:41Z")

</div>

Hi Nitish,

Thanks!!!.

So I can use **_table.skipdatamethods(true)_** before using update\_recordset to restrict calling of update methods correct?

Regards,

Abhishek

---

<div class="post-metadata">

**Author:** ![DevAX](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@DevAX](https://www.dynamicsuser.net/u/DevAX)\
**Post date:** [June 10, 2014, 7:45am UTC](https://www.dynamicsuser.net/t/update-recordset/53240/4 "2014-06-10T07:45:29Z")

</div>

Hi abhishek,

Using **_table.skipdatamethods(true)_** will the fastest but this will skip the code on table update method and that logic will not be executed. An other thing that will cause update\_recordset to be converted to record per record updates is when the database log is configured for that table in AX .

Thanks

Nitish.

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [June 10, 2014, 7:45am UTC](https://www.dynamicsuser.net/t/update-recordset/53240/5 "2014-06-10T07:45:27Z")

</div>

Nitish is right - and you could have found the same simply by reading [the documentation for update\_recordset](http://msdn.microsoft.com/en-us/library/aa674382.aspx).

Also don’t forget that there may be more reasons why things are slow.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Kumar\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Abhishek\_Kumar\_Singh](https://www.dynamicsuser.net/u/Abhishek_Kumar_Singh)\
**Post date:** [June 10, 2014, 7:55am UTC](https://www.dynamicsuser.net/t/update-recordset/53240/6 "2014-06-10T07:55:14Z")

</div>

Hi Nitish,

Yes I know that my logic in update will not be called if I use skipdatamethods. But that is ok for me as the field I need to update will not affect my logic in update in any case.

Anyways I will check for database log you mentioned.

Thanks,

Abhishek

---

<div class="post-metadata">

**Author:** ![denis.p](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@denis.p](https://www.dynamicsuser.net/u/denis.p)\
**Post date:** [June 26, 2017, 7:53pm UTC](https://www.dynamicsuser.net/t/update-recordset/53240/7 "2017-06-26T19:53:42Z")

</div>

I know this thread is rather old, but I’m running into similar scenario.

Whenever I stumble on a sales line with specific flag, I need to update all other sales lines on the same order with serial number dimension from my line. In salesLine.update() method I call a custom method, which looks like this:

```auto
public server static void MyCustomMethod(SalesLine _salesLine)
{
    salesLine salesLineUpd;
    InventDim inventDim;
    
  if ( _salesLine.MyField )
  {
    inventDim = _salesLine.inventDim();

    salesLineUpd.skipDataMethods( true );

    ttsBegin;

    update_recordSet salesLineUpd
    setting PER_ChairSerialNo = inventDim.inventSerialId
    where salesLineUpd.SalesId == _salesLine.SalesId
    && salesLineUpd.RecId != _salesLine.RecId; // update every other line with serial id

    ttsCommit;
  }
}

```

I have 2 environments with exact same X++ code, binaries and CU level.

So, following suggestions in this thread, the update\_recordSet is not chaining a call to salesLine.update() only in one of the two environments. However, it surprisingly does so in another environment.

My question is, despite skipDataMethods(true), what else might force the call to salesLine.update() in one of my environments?

P.S. - Sorry, I keep editing my post. Now it’s final 🙂

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [June 26, 2017, 8:17pm UTC](https://www.dynamicsuser.net/t/update-recordset/53240/8 "2017-06-26T20:17:37Z")

</div>

There are several things that can cause the fallback to row-by-row operation, such as database logging (more in [documentation](https://msdn.microsoft.com/en-us/library/aa849875.aspx)), but I would still think that skipDataMethods() means skipping data methods. But maybe we’re wrong and it actually means that it just doesn’t take data methods into account when considering whether to switch to row-by-row processing and when it does, it calls data methods as usual.

It’s something you can test to be sure how it works.

---

<div class="post-metadata">

**Author:** ![denis.p](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@denis.p](https://www.dynamicsuser.net/u/denis.p)\
**Post date:** [June 26, 2017, 9:13pm UTC](https://www.dynamicsuser.net/t/update-recordset/53240/9 "2017-06-26T21:13:59Z")

</div>

Thanks Martin! You’ve just nailed it. Database logging for updates on SalesLine table was active in one of the environments which was thus falling back to record-by-record update. You rock!
