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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Set based rounding

(0) ShareShare
ReportReport
Posted on by

Does anyone know a way I can round values using set based operations like insert_recordset or update_recordset?  

I have decimal values stored in one table.  I need to pull them into another table either as integers or rounded to the whole dollar.  If I assign the decimal value to the int field in an insert_recordset, I get compiler warnings that the assignment causes loss of precision.  As far as I can tell, insert_recordset and update_recordset do not support method calls so that I can properly round these decimal values to integers.  Is there any set based way to deal with this problem?  I'd love to avoid looping through every record because I have a ton of records to process and row by row is going to be very slow.  

Any suggestion would be greatly appreciated!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Israel Gonzalez Profile Picture
    733 on at

    You can use decRound function (msdn.microsoft.com/.../aa499511.aspx) and later convert to int

  • Greg's Mom Profile Picture
    on at

    Thanks for the suggestion, Israel.  Can you give an example using insert_recordset or update_recordset?  I am not aware of a way to use decRound in these set-based operations.  Using while select forupdate, I could use decRound but I'm looking for an approach to round a very large set of data.  

  • AX 2012 r3 Profile Picture
    2,426 on at

    update_recordset table setting table.field = decround(decimalfield,0)

        join anothertable....

  • Greg's Mom Profile Picture
    on at

    Thanks, Sukrut.  I have been researching and trying a variety of approaches and I think this is my best option.  I have to loop through the records which is a performance hit but using recordinsertlist helps to make the database transaction very fast.  

  • Greg's Mom Profile Picture
    on at

    [quote user="AX 2012 r3"]

    update_recordset table setting table.field = decround(decimalfield,0)

        join anothertable....

    [/quote]

    As far as I know update_recordset does not support the use of functions like this.  The compiler gives me an error: Illegal use of SETTING expression.  

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans