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)

Update_recordset

(0) ShareShare
ReportReport
Posted on by 1,875

Hi all

I don't have any compile error but when I execute code axapta throw an error.

Is it possible do this ? (toDate - custAveragePeriodCollectionTrans.DueDate) 

update_recordSet custAveragePeriodCollectionTrans
setting DueDays = toDate - custAveragePeriodCollectionTrans.DueDate;

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    shayan arshi Profile Picture
    40 on at
    RE: Update_recordset

    shayanarshi.blogspot.com/.../update-record-set-using-updaterecordset.html

    This will be helpful to you for insertion

  • XB Profile Picture
    1,875 on at
    RE: Update_recordset

    Hi Vilmos

    I saw this links for this reason I was asking if it's possible, I supose  you are right an record buffer is empty.

  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Update_recordset

    You have 0 value in your record buffer, so date-0=date, which you cannot save in an int field. AX does not work in a way you assume, so the actually selected buffer is not referrable for the set operation.

    You have to join in the datasource once more i.e. using RecId as a link, then you could put that second buffers' value in the deduction.

    See example 3 in the documentation:

    https://msdn.microsoft.com/en-us/library/aa674382.aspx

  • XB Profile Picture
    1,875 on at
    RE: Update_recordset

    DueDays is an integer and DueDate is a date (EDT DueDate)

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Update_recordset

    msdn.microsoft.com/.../aa865135.aspx

    You may add and subtract date from date, and int from date. If it is of any other type i.e. utcdatetime or int64 it will likely not work. You could try to convert the utcdatetime figures into a date with the DateTimeUtil collection class.

    You could also wrap around the whole arithmetic function with an any2int() to clearly state for whomever is reading the code that you are expecting an integer in the DueDays field.

  • Mea_ Profile Picture
    60,284 on at
    RE: Update_recordset

    Hi Javier Biesa,

    Generally you can do this, but this table looks like custom one, what are the types of DueDays and DueDate fields ?

  • Anton Venter Profile Picture
    20,260 Super User 2025 Season 2 on at
    RE: Update_recordset

    Hi Javier, it is not possible with the update_recordset statement in X++ to update a field by calculating a value of other fields. In this case you will have to change your code to a record based operation i.e. a while select statement and update each record individually.

  • XB Profile Picture
    1,875 on at
    RE: Update_recordset

    8875.1.png

    Error is for use the expression (toDate - CustAveragePeriodCollectionTrans.DueDate)

  • @rp@n Profile Picture
    28 on at
    RE: Update_recordset

    Hi Javier

    Can you please let me know the exact error with screen shot.

    Arpan Sen

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
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans