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 :
Finance | Project Operations, Human Resources, ...
Answered

x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

(0) ShareShare
ReportReport
Posted on by

Description:

i want get the max value and min value of decimal by X++  code? but i didn't know how can i  write it, if you know , please tell me ,thanks!

I have the same question (0)
  • Liya Cheng Profile Picture
    on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    thanks, i have nothing to ask.

  • Liya Cheng Profile Picture
    on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    Thanks  for your answer.

  • Liya Cheng Profile Picture
    on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    Thanks Blue, i got it.

  • Liya Cheng Profile Picture
    on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    yeah, if we for loop many times , it will exceed the size of the data type. in actual, it has been exceeed the size when for loop to 41. , i check the result of  for loop 41, it will exceed the size of max value.  

    result = -8181818181818182000000000000.0000000000000 * (-10) + (-0.0000000000009)

  • Martin Dráb Profile Picture
    236,275 Most Valuable Professional on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    Yes, that's the range of System.Decimal, as mentioned before.

  • Verified answer
    Blue Wang Profile Picture
    on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    Hi Apple,

    00355.PNG

    https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-data-primitive

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    Could you tell us your business requirement and what you are trying to achieve? Since you work in x++, your variable/field must be an x++ real type and you should worry about min/max value of that data type, nothing else.

  • Verified answer
    Martin Dráb Profile Picture
    236,275 Most Valuable Professional on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    Your code is designed to exceed the size of the data type sooner or later, which it does, therefore everything look correct. The only remaining question is "What your point?".

  • Liya Cheng Profile Picture
    on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    sorry, you can check my question, i ask two question, real and decimal, but i misspelled  with decimal in the title.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: x++: how can i get the maxValue and minValue of real and decomal by using code in Dy365F&O?

    What exactly are you trying to do?

    The min/max value of a real field in x++ is the one that is already told to you several times (pointed into Microsoft documentation, and to functions which will show you the value in code).

    It seems that even though your original question is now answered many times, you still have some other problem. I suggest sharing your actual problem (including business requirement) right in the beginning to save everyone's time and guarantee best possible help to you.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,239

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 903 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 604 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans