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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Empty field validation

(0) ShareShare
ReportReport
Posted on by 70

Is there any functions to calculate integer length / or empty

I have the same question (0)
  • Anton Venter Profile Picture
    20,672 Super User 2026 Season 1 on at

    Can you elaborate more?

  • gaya3 killy Profile Picture
    70 on at

    I need to check a integer field length and also if empty

  • Suggested answer
    Mohit Rampal Profile Picture
    12,573 Moderator on at

    Hi, I believe you are looking for function like StrLen() for checking length of String. There isn't any function to check it for Integer. An empty integer value is zero.

    To check number of digits in integer field you can use this '

    strlen(int2str(IntegerField));

    Please check this thread

    community.dynamics.com/.../is-it-possible-to-limit-an-integer-edt-to-a-certain-number-of-digits

    www.dynamicsuser.net/.../54003

  • gaya3 killy Profile Picture
    70 on at

    I need to check if an integer field is empty

  • Suggested answer
    Anton Venter Profile Picture
    20,672 Super User 2026 Season 1 on at

    "Empty" would be 0 as mentioned by Mohit.

  • Martin Dráb Profile Picture
    239,643 Most Valuable Professional on at

    There are no nullable integers in X++. An empty integer is the integer with the default value, which is zero.

    The length can also be checked with normal mathematical operators, instead of doing a conversion to string. For example, (positive) integers with less than two characters are smaller than 100.

    If the number can be negative, consider if you want to calculate the sign in the length. If not, you can use the absolute value. instead of the actual field value.

  • gaya3 killy Profile Picture
    70 on at

    I have a form on which when i click a button , it opens 1st dialog . the first dialogs has 2 fields when i click ok on 1st dialog it opens 2nd dialog . i need validation at 1st dialog that if fields are empty is shouldn't open second dialog. How can i achieve it ?

  • Verified answer
    GirishS Profile Picture
    27,843 Moderator on at

    You can add your validation on the CanClose method on the 1st dialog form.

    canClose returns boolean value.

    public boolean canClose()]
    {
        boolean ret;
        ret = super();
        //add your logic for integer validation
        if(int == 0)
        {
            ret= checkfailed("Warning");
        }
        return ret;
    }

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,573 Moderator on at

    If you need validation on click of OK button in dialog then you can add your validation in if (dialog.closedOk()) loop.

    https://wp.me/p6FQUH-30

  • gaya3 killy Profile Picture
    70 on at

    I Wrote 2  validations on canclose method but its not working. initially i was trying to close the form from 2nd dialog and i changed it . i am closing after clicking the button but its not working.

    thanks

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 797

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 589 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 534

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans