Notifications
Announcements
No record found.
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!
select minOf(MyField) from myTable; info(strFmt("Min value: %1", myTable.MyField)); select maxOf(MyField) from myTable; info(strFmt("Max value: %1", myTable.MyField));
Hi Apple,
Can you explain if you want to know the min and max for table values used or the data type itself? If it is about used values, then the reply from Nikolaos should be your answer.
please refer global class, you can find datemax(), realmax(), intmax(), etc.
This method couldn't return the max value or min value of decimal, because , i get a error (Microsoft.Dynamics.Ax.Xpp.ClrErrorException: OverflowException ---> System.OverflowException: Value was either too large or too small for a Decimal.), but i don't know the max value and min value of decimal in ax, so i want to know their value
Do you still have some open questions or is your original issue now resolved? If it's now resolved, please mark the helpful answer(s) as verified. Thanks!
i want to know the max value and min value of decimal data type itself, because i get a error about decimal (error:Actual: Value was either too large or too small for a Decimal ), but i don't know the size of it, so please tell me if you know, thanks!
No , the issue doesn't resolved yet, your method couldn't address my issue. so i need continue to ask, thanks!
i check the Global class, but nothing about the value of decimal
What do you mean by "decimal"? You can find the max/min value of "real" data type in Global class (realMax() and realMin() methods). Decimals are handled as real data type in x++.
Can you share your code? Where is the "bad" value coming from? Please tell us more about your situation.
Decimal is a CLR type, not an X++ type, therefore simply look into .NET documentation: Decimal Struct. It says:
The Decimal value type represents decimal numbers ranging from positive 79,228,162,514,264,337,593,543,950,335 to negative 79,228,162,514,264,337,593,543,950,335.
If you need a check in code, use its properties called MinValue and MaxValue.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader