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, ...
Suggested answer

Real field mandatory but should allow 0

(0) ShareShare
ReportReport
Posted on by 92
Hello,
 
I have a  real field that is mandatory. How can I allow it to insert 0 as a value and not look into that 0 as empty? When I put "show zero" property to No, whenever I enter 0 in the field it resets to empty.
So the requirement is to be mandatory but being able to enter 0, so to distinguish between empty (null) value and 0 as value.
Is this possible in X++?
 
Thanks in advance
Categories:
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    236,258 Most Valuable Professional on at
    Real field mandatory but should allow 0
    It's impossible. You're wrong in thinking that a real field can contain null. A real field is considered empty if its value is zero; whether you see the number or an empty field is just the matter of visualization.
     
    If you make it mandatory, you're saying that it mustn't be zero. If you want to accept zero, it can't be mandatory. You can't allow and disallow zero at the same time.
     
    You can implement such behavior, but you'll need an extra piece of information saying whether the field is considered empty or zero. Such as an additional boolean field (and you'll allow edition of the real field only when the boolean field is true).
  • Sohaib Cheema Profile Picture
    48,646 User Group Leader on at
    Real field mandatory but should allow 0
    Hi,
     
    In x++ real number 0.0 is treated as null (in other words there is no Null) You can read it here: https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-variables-data-types#null-values-for-data-types
     
    If you can describe your business problem(without talking about code), someone may suggest a solution.
     

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,257

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 611 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans